[llvm-branch-commits] [clang] [Clang] Add pointer field protection feature. (PR #172119)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 12 19:34:57 PST 2026
================
@@ -3802,6 +3808,22 @@ OPT_LIST(V)
StringRef getCUIDHash() const;
+ void findPFPFields(QualType Ty, CharUnits Offset,
----------------
pcc wrote:
The code patterns that trigger a call to findPFPFields/hasPFPFields are relatively rare (pass by value/generated copies). And for pass by value the number of fields is expected to be relatively small. So producing the list every time is O(N) where N is the expected-small # of fields vs doing a cache lookup is O(log N) where N is the # of classes in the ASTContext, assuming a side table is used to store the cache. So it's unclear that it would be beneficial to cache it.
The offset is there to support recursive calls. Certainly that could be hidden by wrapping the function, no strong opinions about whether to do this or not.
https://github.com/llvm/llvm-project/pull/172119
More information about the llvm-branch-commits
mailing list