[llvm-branch-commits] [clang] [LifetimeSafety] Track per-field origins for record types (PR #195603)

Zhijie Wang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 11 00:04:19 PDT 2026


================
@@ -131,6 +131,20 @@ class OriginNode {
     return nullptr;
   }
 
+  /// To reach the record, peels the base's outer origin when the
+  /// base is a glvalue (`IsGLValue`) and one more level for an arrow access
+  /// (`IsArrow`), then looks up `FD`. Returns null if `FD` is not reachable.
+  OriginNode *resolveMemberField(const FieldDecl *FD, bool IsGLValue,
----------------
aeft wrote:

This method is changed from `getFieldChildInChain`, I moved to this PR since it has more context here (i.e., its two callsites):

```cpp
  OriginNode *getFieldChildInChain(const FieldDecl *FD) const {

    for (const OriginNode *N = this; N; N = N->getPointeeChild())
      if (OriginNode *Child = N->getFieldChild(FD))
        return Child;
    return nullptr;
  }
```

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


More information about the llvm-branch-commits mailing list