[clang] [LifetimeSafety] Add suggestion and inference for implicit this (PR #176703)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 23 08:56:44 PST 2026
================
@@ -137,6 +137,12 @@ OriginList *OriginManager::getOrCreateList(const Expr *E) {
return It->second;
QualType Type = E->getType();
+ // Special handling for 'this' expressions to share origins with the method's
+ // implicit object parameter.
+ if (isa<CXXThisExpr>(E)) {
+ if (const auto *MD = dyn_cast<CXXMethodDecl>(CurrentDecl))
+ return getOrCreateList(MD);
+ }
----------------
usx95 wrote:
nit: remove braces
https://github.com/llvm/llvm-project/pull/176703
More information about the cfe-commits
mailing list