[llvm-branch-commits] [clang] [LifetimeSafety] Detect dangling fields (PR #177363)

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 22 09:49:40 PST 2026


================
@@ -138,25 +139,33 @@ OriginList *OriginManager::getOrCreateList(const Expr *E) {
 
   QualType Type = E->getType();
 
-  // Special handling for DeclRefExpr to share origins with the underlying decl.
-  if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
+  // Special handling for expressions referring to a decl to share origins with
+  // the underlying decl.
+  const ValueDecl *ReferencedDecl = nullptr;
+  if (auto *DRE = dyn_cast<DeclRefExpr>(E))
+    ReferencedDecl = DRE->getDecl();
+  if (auto *ME = dyn_cast<MemberExpr>(E))
----------------
Xazax-hun wrote:

```suggestion
  else if (auto *ME = dyn_cast<MemberExpr>(E))
```

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


More information about the llvm-branch-commits mailing list