[clang] [clang] Add one-entry cache for ASTContext::getDeclAttrs() (PR #226610)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 01:50:00 PDT 2026
================
@@ -1532,12 +1533,17 @@ DiagnosticsEngine &ASTContext::getDiagnostics() const {
}
AttrVec& ASTContext::getDeclAttrs(const Decl *D) {
+ if (LastDeclAttrsDecl == D)
+ return *LastDeclAttrs;
----------------
zmodem wrote:
Maybe `assert(LastDeclAttrs != nullptr && LastDeclAttrs == DeclAttrs[D])` here to ensure cache consistency?
https://github.com/llvm/llvm-project/pull/226610
More information about the cfe-commits
mailing list