[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 05:07:06 PDT 2026


================
@@ -15576,6 +15679,12 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
     }
   }
 
+  // Validate variables named in '-mloadtime-comment-vars=': supported string
+  // variables get an implicit attribute that CodeGen uses to preserve them;
+  // named variables that cannot be preserved are diagnosed.
+  if (!getLangOpts().LoadTimeCommentVars.empty() && !VD->isInvalidDecl())
----------------
AaronBallman wrote:

I think it'd make more sense to move this predicate into `processForLoadTimeCommentVar()` and call `Sema::ProcessLoadTimeCommentVar()` from here instead of calling the helper function.

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


More information about the llvm-commits mailing list