[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 Jul 17 09:21:48 PDT 2026


================
@@ -4389,6 +4390,116 @@ bool CodeGenModule::MayBeEmittedEagerly(const ValueDecl *Global) {
   return true;
 }
 
+/// Classify a variable whose mangled name matched the -mloadtime-comment-vars=
+/// list, deciding whether it can be preserved, must be diagnosed, or should be
+/// silently ignored.
+CodeGenModule::LoadTimeCommentVarKind
+CodeGenModule::classifyLoadTimeCommentVariable(const VarDecl *D) const {
----------------
w2yehia wrote:

why are we doing diagnostics in CodeGen rather than in Sema?
It would be nice to diagnose in Sema, and remove any invalid/duplicate entries. Then in CodeGen you just check if the name matches, and you wouldn't need to classify anything.

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


More information about the cfe-commits mailing list