[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 4 21:09:05 PDT 2026
================
@@ -0,0 +1,64 @@
+// Verify that -mloadtime-comment-vars= diagnoses named C variables it cannot
+// preserve. The diagnostics are produced by Sema and fire even with
+// -fsyntax-only.
+//
+// Covered cases:
+// - volatile-qualified pointer (char *volatile)
+// - pointer-to-volatile character (volatile char *)
+// - volatile character array (volatile char[])
+// - thread-local variable (__thread, not static storage duration)
+// - pointer not initialized directly with a string literal
+// - name-matched variables of an unsupported type (int, unsigned char)
+// - valid const char array — no diagnostic
+// - a preserved variable counts as used: no -Wunused-const-variable for it,
+// while an unlisted static const variable still warns
+//
+// The NONAIX scenario invokes cc1 directly for a non-AIX target: the option
+// is rejected with an error.
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -Wunused-const-variable \
+// RUN: -mloadtime-comment-vars=vol_ptr,vol_char,vol_arr,tls_ptr,ind_ptr,const_arr,lfn,kept,notchar,ustr \
----------------
hubert-reinterpretcast wrote:
Exactly how does `lfn` match the symbol name used for the function-local static? The compiler names it `h.lfn`, no?
https://github.com/llvm/llvm-project/pull/187986
More information about the llvm-commits
mailing list