[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 01:53:52 PST 2024


================
@@ -249,7 +254,7 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path,
                                                   LocalVisitor Visit);
 
 template <typename T> static bool isRecordWithAttr(QualType Type) {
-  if (auto *RD = Type->getAsCXXRecordDecl())
+  if (auto *RD = Type.getNonReferenceType()->getAsCXXRecordDecl())
----------------
usx95 wrote:

Removing this will create a false positive for the following 2 cases only:
```cpp
vsv.push_back(getOptionalSV().value());
vsv.push_back(getOptionalMySV().value());
```

https://github.com/llvm/llvm-project/pull/115921


More information about the cfe-commits mailing list