[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)
Tony Varghese via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 03:05:22 PDT 2026
================
@@ -15452,6 +15520,13 @@ 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() &&
+ Context.getTargetInfo().getTriple().isOSAIX())
----------------
tonykuttai wrote:
As per our offline discussion, implemented the following: the driver keeps the warning-and-drop behavior, and cc1 now rejects the option on non-AIX targets with an error (`err_drv_unsupported_opt_for_target` similar to `-mabi=quadword-atomics` and `-mxcoff-roptr checks`). With `cc1` enforcing the target, the Sema-side AIX check originally flagged is indeed implied by the option list being non-empty, and is removed. This closes the `-Xclang -mloadtime-comment-vars=` path on non-AIX drivers, which previously was a silent no-op.
https://github.com/llvm/llvm-project/pull/187986
More information about the llvm-commits
mailing list