================
@@ -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:

Not implied currently. The driver's AIX gating only covers driver invocations. 
`clang -cc1` can be reached directly with any triple/option combination and 
`-Xclang -mloadtime-comment-vars=` can carry the `cc1` option past the driver 
check on any target. So Sema enforces the target restriction itself rather than 
inheriting it from driver gating.

I've moved the this check into `processForLoadTimeCommentVar()` with a comment 
to that effect, so the helper owns all of its applicability conditions . The 
resulting behavior  for other targets: diagnose & discard by the driver and 
quietly ignore at the cc1 layer . 



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