[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)
Wael Yehia via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 19 09:44:21 PDT 2026
================
@@ -1077,6 +1077,13 @@ void CodeGenModule::Release() {
Module *Primary = getContext().getCurrentNamedModule();
if (CXX20ModuleInits && Primary && !Primary->isHeaderLikeModule())
EmitModuleInitializers(Primary);
----------------
w2yehia wrote:
I don't see precedence for walking the translation unit, visiting each global variable decl, during codegen.
Why don't we process the list during CodeGenModule::EmitGlobal (which I assume is called for every GlobalDecl).
1) You would teach `MustBeEmitted()` to return true (no need to return true for `MayBeEmittedEagerly()` I think because adding to `DeferredDeclToEmit` is sufficient I think) for variables whose names occur in the `LoadTimeCommentVars` list; and
2) teach EmitGlobalVarDefinition to generate the MD if its name occurs in the `LoadTimeCommentVars` list.
Alternatively, you can create a list of variables that need the MD, but since this feature is optional, I wouldn't add a new list to `CodeGenModule`, and instead do the lookup twice (as described above) and only if the LoadTimeCommentVars is non-empty.
https://github.com/llvm/llvm-project/pull/187986
More information about the cfe-commits
mailing list