================
@@ -0,0 +1,270 @@
+// C/C++ behavior of -mloadtime-comment-vars= :
+//   codegen.cpp - mangled-name matching and what gets preserved
+//   storage.cpp - storage-duration and scope diagnostics
+//   diag.c      - volatile / non-string-literal diagnostics (C)
+//   init.cpp    - constant-initialization / string-literal diagnostics (C++)
+//   list.c      - list parsing: whitespace after a comma, repeated names
+
+// RUN: rm -rf %t && split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++17 -O2 -triple powerpc64-ibm-aix \
+// RUN:   
-mloadtime-comment-vars=x,_ZN1N1xE,_ZN1N1qE,_ZN1NL3ptrE,_ZN1A1xE,_ZN1B3verE,_ZN1C4infoE
 \
+// RUN:   -emit-llvm -disable-llvm-passes -o - %t/codegen.cpp | FileCheck 
%t/codegen.cpp
+//
+// RUN: %clang_cc1 -std=c++17 -triple powerpc64-ibm-aix \
+// RUN:   -mloadtime-comment-vars=keep,_ZN1N2tlE,_ZL3stl,_ZN1A2tmE,_ZZ1fvE2fn \
+// RUN:   -emit-llvm -verify -o - %t/storage.cpp | FileCheck %t/storage.cpp
+//
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix \
+// RUN:   
-mloadtime-comment-vars=vol_ptr,vol_char,vol_arr,tls_ptr,ind_ptr,const_arr \
+// RUN:   -emit-llvm -verify -o - %t/diag.c | FileCheck %t/diag.c
+//
+// RUN: %clang_cc1 -std=c++17 -triple powerpc64-ibm-aix \
+// RUN:   -mloadtime-comment-vars=p_ok,arr_ok,p_dyn,p_ind \
+// RUN:   -emit-llvm -verify -o - %t/init.cpp | FileCheck %t/init.cpp
+//
+// The diagnostics are produced by Sema, so they are emitted even when no code
+// is generated.
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix \
+// RUN:   
-mloadtime-comment-vars=vol_ptr,vol_char,vol_arr,tls_ptr,ind_ptr,const_arr \
+// RUN:   -fsyntax-only -verify %t/diag.c
+// RUN: %clang_cc1 -std=c++17 -triple powerpc64-ibm-aix \
+// RUN:   -mloadtime-comment-vars=p_ok,arr_ok,p_dyn,p_ind \
+// RUN:   -fsyntax-only -verify %t/init.cpp
+//
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix \
+// RUN:   "-mloadtime-comment-vars=foo, bar" \
+// RUN:   -emit-llvm -o - %t/list.c | FileCheck %t/list.c --check-prefix=SPACE
+//
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix \
+// RUN:   -mloadtime-comment-vars=foo,foo \
+// RUN:   -emit-llvm -o - %t/list.c | FileCheck %t/list.c --check-prefix=DUP
+
+//--- codegen.cpp
+// Names are matched against mangled IR symbol names.
+// C++ variables use Itanium ABI mangling; C/file-scope statics keep their
+// source name.
+//
+// Mangled names used here:
+//   x            -> x             (file-scope, no mangling)
+//   N::x         -> _ZN1N1xE
+//   N::q         -> _ZN1N1qE
+//   N::ptr       -> _ZN1NL3ptrE   (static, internal linkage)
+//   A::x         -> _ZN1A1xE
+//   B::ver       -> _ZN1B3verE
+//   C::info      -> _ZN1C4infoE   (declared only, no definition — skipped)
+
+// 1. File-scope array "x" — no mangling in C++, IR name == source name.
+char x[] = "@(#) global x";
+
+namespace N {
+char x[] = "@(#) ns x";
----------------
tonykuttai wrote:

Right, removed N::q. It was a left over from when we used the un-mangled names 
to match.

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