[llvm-branch-commits] [clang] [LifetimeSafety] Track per-field origins for record types (PR #195603)
Gábor Horváth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jun 11 02:37:51 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,
----------------
Xazax-hun wrote:
I see! Because we represent lvalues as the borrow of the storage, that is one more layer we sometimes need to peel depending on the value category. I think this should always be handled at the call site, as in the callee that processes the expression should always know the value category and should always know if we need to make that hop or not. And this happening in many cases via calling things like `getRValueOrigin` or similar (might misremember). I think we should keep this pattern where the value category is handled always very close to the expression that we are processing, and the field lookup should be handled separately in the tree without conflating the two.
https://github.com/llvm/llvm-project/pull/195603
More information about the llvm-branch-commits
mailing list