[clang] [llvm] [Clang][AST][NFCI] Make Decl reference attributes directly (PR #219138)
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 00:55:03 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;
----------------
zygoloid wrote:
As a cheap experiment, can you try putting back a padding bit where the old `hasAttr` bit was and rerunning a comparison against the baseline? (So we're measuring map versus storage-in-Decl, and not treating the Decl storage as free.) That should give us a quick idea of what proportion of Decls actually end up with a non-null attribute pointer, without "cheating" by reusing the padding bits in Decl that are only there by accident.
https://github.com/llvm/llvm-project/pull/219138
More information about the llvm-commits
mailing list