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

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 4 21:01:11 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
----------------
hubert-reinterpretcast wrote:

Function local static _is_ covered but not listed here.

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


More information about the cfe-commits mailing list