[clang] std::meta is an associated namespace of reflect-expressions. (PR #242722)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 01:48:18 PST 2026


================
@@ -12706,6 +12706,27 @@ NamespaceDecl *Sema::getStdNamespace() const {
                                  StdNamespace.get(Context.getExternalSource()));
 }
 
+NamespaceDecl *Sema::lookupStdMetaNamespace() {
+  NamespaceDecl *StdMeta = cast_or_null<NamespaceDecl>(
+      StdMetaNamespace.get(Context.getExternalSource()));
+  if (StdMeta)
+    return StdMeta;
+
+  NamespaceDecl *Std = getStdNamespace();
----------------
cor3ntin wrote:

I'm not sure I buy it? In both cases it's cached.
Either way, ASTReader/ASTWriter need to know about `StdMetaNamespace` afaict - they know about the std namespace.

I don't think we should modify `ActOnStartNamespaceDef` - doing lookup when we need it seems like the better approach.

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


More information about the cfe-commits mailing list