[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 14:47:35 PDT 2026
================
@@ -0,0 +1,117 @@
+// Test -mloadtime-comment-vars= across a C++20 named-module boundary. Five
+// scenarios, each named by its FileCheck or -verify prefix:
+//
+// MOD — the module unit is built to a BMI with the option and then
+// compiled to IR from the BMI (the two-phase flow build systems
+// use). Exported, module-linkage, internal-linkage, and inline
+// variables are all preserved: the implicit attribute is
+// serialized, and the internal and inline variables reach
+// CodeGen via the module-initializer list. The same IR is
+// produced whether or not the option is repeated on the
+// codegen step: the BMI already records the result.
+// NOOPT + — the same module unit built to a BMI without the option and
+// NOOPTNOT compiled to IR with it: nothing is preserved. The option
+// applies to the compilation of the module unit itself, where
+// semantic analysis runs.
+// IMPORT + — an importing TU naming the module-owned variable: the
+// IMPORTNOT variable is defined in the module unit, not here, so it is
+// neither re-emitted nor preserved here, and the module-internal
+// variable does not leak into the importer. The inline variable
+// it references is re-emitted here as usual for inline
+// variables, and that copy is preserved as well because the
+// attribute travels with the declaration in the BMI.
+// verify — specializations instantiated here from the imported template
+// definitions are diagnosed in this TU, at the pattern location
+// in the module interface, with a note at the instantiation
+// point.
----------------
hubert-reinterpretcast wrote:
Prior review comments had already noted that diagnostics should be checked in Sema tests, not CodeGen ones.
https://github.com/llvm/llvm-project/pull/187986
More information about the llvm-commits
mailing list