================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to