[clang] [LifetimeSafety] Detect use-after-scope through fields in member calls (PR #191731)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 07:31:17 PDT 2026
================
@@ -723,6 +723,38 @@ void FactsGenerator::handleInvalidatingCall(const Expr *Call,
ThisList->getOuterOriginID(), Call));
}
+void FactsGenerator::handleImplicitObjectFieldUses(const Expr *Call,
+ const FunctionDecl *FD) {
+ const auto *MD = dyn_cast<CXXMethodDecl>(FD);
+ if (!MD || !MD->isInstance())
+ return;
+
+ const auto *MemberCall = dyn_cast_or_null<CXXMemberCallExpr>(Call);
+ if (!MemberCall)
+ return;
+
+ if (!dyn_cast_or_null<CXXThisExpr>(MemberCall->getImplicitObjectArgument()))
----------------
usx95 wrote:
Prefer to use `isa_and_present` instead of casting.
https://github.com/llvm/llvm-project/pull/191731
More information about the cfe-commits
mailing list