[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 03:54:38 PST 2024
================
@@ -249,9 +254,10 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path,
LocalVisitor Visit);
template <typename T> static bool isRecordWithAttr(QualType Type) {
- if (auto *RD = Type->getAsCXXRecordDecl())
- return RD->hasAttr<T>();
- return false;
+ CXXRecordDecl *RD = Type.getNonReferenceType()->getAsCXXRecordDecl();
----------------
Xazax-hun wrote:
I am a bit worried here. While `lifetime_capture_by` applies to the value behind the reference, `lifetimebound` always apply to the top level construct (so the reference itself). So I am wondering if this change is correct when we process a lifetimebound annotation.
https://github.com/llvm/llvm-project/pull/115921
More information about the cfe-commits
mailing list