[clang] [llvm] [Clang][AST][NFCI] Make Decl reference attributes directly (PR #219138)
Erich Keane via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 07:14:15 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:
Well... huh. I don't see any of the 'well we can just steal a bit from here' areas to this either. So this is something that we didn't realize happened at one point (probably OMP adding to the IdentifierNamespace).
I still want to hear @AaronBallman 's feedback on this one, but I'm leaning towards in favor unless there is something I'm missing.
ONE thing as a 'lets improve things while we are here': Can we add a static-assert on `sizeof(Decl)` to make sure we don't accidentally grow it in the future?
https://github.com/llvm/llvm-project/pull/219138
More information about the llvm-commits
mailing list