[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)
----------------
zmodem wrote:

Maybe add a short comment about why having a cache here is beneficial? ("85% of lookups use the most recent D")

https://github.com/llvm/llvm-project/pull/226610


More information about the cfe-commits mailing list