[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:08:26 PDT 2026


================
@@ -15460,6 +15461,108 @@ void Sema::CheckThreadLocalForLargeAlignment(VarDecl *VD) {
   }
 }
 
+/// Process a variable definition whose mangled name may be listed in
+/// '-mloadtime-comment-vars=': attach an implicit attribute to supported
+/// string variables so CodeGen preserves them as loadtime identifying
+/// strings, and warn when a named variable cannot be preserved.
+static void processForLoadTimeCommentVar(Sema &S, VarDecl *VD) {
----------------
AaronBallman wrote:

I forgot that this was supposed to be limited to strings, so a more interesting test case would be an array of `char *` that gets expanded into the binding declarations. But given that this is going for existing code patterns, you may prefer to just reject things which aren't `VarDecl` until you have a use case requiring it be supported.

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


More information about the llvm-commits mailing list