[clang] [Clang] Cache stable DeclContext relationships (NFC) (PR #223047)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 20:06:39 PDT 2026


================
@@ -2101,6 +2102,17 @@ class DeclContext {
   /// another pointer.
   mutable Decl *LastDecl = nullptr;
 
+  /// A primary context whose identity cannot change. Incomplete C++ records
+  /// and contexts with mutable primary identities remain uncached.
+  /// Relaxed atomics permit cache population during concurrent read-only AST
+  /// traversal; they do not synchronize mutations to the AST itself.
+  mutable std::atomic<DeclContext *> CachedPrimaryContext = nullptr;
----------------
zwuis wrote:

Do/Should we support concurrent traversal?

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


More information about the cfe-commits mailing list