================
@@ -810,9 +810,11 @@ void FactsGenerator::handleInvalidatingCall(const Expr 
*Call,
 
   if (!isInvalidationMethod(*MD))
     return;
-  // Heuristics to turn-down false positives.
-  auto *DRE = dyn_cast<DeclRefExpr>(Args[0]);
-  if (!DRE || DRE->getDecl()->getType()->isReferenceType())
+
+  // Heuristics to turn-down false positives. Skip member field expressions for
+  // now. This is not a perfect filter and will still surface some false
+  // positives (e.g. `auto& r = s.v`).
+  if (!isa<DeclRefExpr>(Args[0]->IgnoreParenImpCasts()))
----------------
zeyi2 wrote:

I use `IgnoreParenImpCasts` here to handle: `(v).push_back(x)`, 

-----

v.push_back(x):

```
CXXMemberCallExpr
|-MemberExpr .push_back
| `-DeclRefExpr 'v'
`-ImplicitCastExpr
  `-DeclRefExpr 'x'
```

-----

(v).push_back(x):

```
CXXMemberCallExpr
|-MemberExpr .push_back
| `-ParenExpr
|   `-DeclRefExpr 'v'
`-ImplicitCastExpr
  `-DeclRefExpr 'x'
```

https://github.com/llvm/llvm-project/pull/197873
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to