-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang-tidy][NFC] Enable bugprone-unchecked-optional-access in clang-tidy config and fix warnings
#170004
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
base: main
Are you sure you want to change the base?
Conversation
…idyDiagnosticConsumer" This reverts commit 7f6239f.
| } | ||
|
|
||
| void ClangTidyProfiling::storeProfileData(llvm::TimerGroup &TG) { | ||
| assert(Storage && "We should have a filename."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix the removal of this assert soon.
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
1b736ad to
11e86d6
Compare
| assert(Scale && "Unknown scale encountered"); | ||
| if (!Scale) | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we then remove first assert if we still check via if later? (but preserve comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels weird that dataflow framework didn't count it as "validation", could it be a FP?
Later, you used assert(BestConversion && "text"); for the same purpose of validation
| if (SK == SK_Invalid || !NamingStyles[SK]) | ||
| if (SK == SK_Invalid) | ||
| return std::nullopt; | ||
|
|
||
| const IdentifierNamingCheck::NamingStyle &Style = *NamingStyles[SK]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So dataflow couldn't handle checking for multiple optional values in one go? Seems like FP.
| Context.getOptions().HeaderFilterRegex | ||
| ? StringRef(*Context.getOptions().HeaderFilterRegex) | ||
| : StringRef("")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use .value_or() here? (and later)
Closes #156151