[clang] [clang]: support std::meta::info for primitive types (PR #190356)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 4 08:45:59 PDT 2026


================
@@ -6158,6 +6085,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
   if (getLangOpts().OpenCL && ASTTy->isSamplerT())
     return;
 
+  if (getLangOpts().Reflection && ASTTy->isMetaInfoType())
----------------
Sirraide wrote:

So actually, considering that you _can_ e.g. have variables of type `std::meta::info` w/ external linkage (https://github.com/llvm/llvm-project/pull/190356#discussion_r3035705278), we might need this test here because if a variable has external linkage, I believe we just emit it irrespective of whether it’s used anywhere. In that case however we should not check for `getLangOpts().Reflection` here—if you get a value of type `std::meta::info` while that’s disabled something has gone horribly wrong somewhere anyway

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


More information about the cfe-commits mailing list