================
@@ -42,7 +42,16 @@ void
MisplacedWideningCastCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(varDecl(hasInitializer(Cast)), this);
Finder->addMatcher(returnStmt(hasReturnValue(Cast)), this);
Finder->addMatcher(callExpr(hasAnyArgument(Cast)), this);
- Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this);
+ // When assigning to a bit field, bind the FieldDecl so check() can use the
+ // actual bit width instead of the declared type width. optionally() ensures
+ // the matcher still fires for assignments to a field which is not a bit
field
+ // (binding is absent).
----------------
vbvictor wrote:
```suggestion
// When assigning to a bit field, bind the FieldDecl so check() can use the
// actual bit width instead of the declared type width.
```
Second part of comment is excessive, it is just description of `optional()`
https://github.com/llvm/llvm-project/pull/197554
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits