[clang] [llvm] [Clang][AST][NFCI] Make Decl reference attributes directly (PR #219138)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 27 06:31:53 PDT 2026
================
@@ -355,6 +351,13 @@ class alignas(8) Decl {
LLVM_PREFERRED_TYPE(Linkage)
mutable unsigned CacheValidAndLinkage : 3;
+ /// The attributes attached to this declaration, or null if it has none.
+ ///
+ /// This pointer is the sole record of whether the declaration has
+ /// attributes, so it must be cleared whenever the vector becomes empty.
+ /// Owned by the ASTContext that allocated it.
+ AttrVec *Attrs = nullptr;
----------------
erichkeane wrote:
So this pointer is actually really expensive. Right now it seems we're trading a massive amount of memory for a mild amount of runtime perf. Are we sure that is worth it?
https://github.com/llvm/llvm-project/pull/219138
More information about the cfe-commits
mailing list