Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(.clang-tidy): adds bugprone-unchecked-optional-access check #3911

Merged

Conversation

zulfaqar-azmi-t4
Copy link
Contributor

@zulfaqar-azmi-t4 zulfaqar-azmi-t4 commented Oct 18, 2023

Description

Add checks for optional access
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unchecked-optional-access.html

For example with the PR, the following will give a warning

std::optional<int> opt_var;

auto var = *opt_var; // accessing-optional without any checks might cause error on runtime

Tests performed

Not applicable.

Effects on system behavior

Not applicable.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

Copy link
Contributor

@xmfcx xmfcx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@xmfcx xmfcx merged commit afad2da into autowarefoundation:main Nov 15, 2023
15 checks passed
@zulfaqar-azmi-t4 zulfaqar-azmi-t4 deleted the add-optional-access-check branch December 1, 2023 02:57
oguzkaganozt pushed a commit that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants