summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp
diff options
context:
space:
mode:
authorEvgeny Astigeevich <evgeny.astigeevich@arm.com>2014-12-12 16:17:46 +0000
committerEvgeny Astigeevich <evgeny.astigeevich@arm.com>2014-12-12 16:17:46 +0000
commit665027dbc4d648eb2a78e591352ad9528db914f6 (patch)
treeb3f856df5624a4c5924408bc1a467cb5a0e76205 /clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp
parent716809b83ce6b93823ed9b473ad5ede54be76005 (diff)
downloadbcm5719-llvm-665027dbc4d648eb2a78e591352ad9528db914f6.tar.gz
bcm5719-llvm-665027dbc4d648eb2a78e591352ad9528db914f6.zip
Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):
A discriminator is used for the first occurrence of a name. inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. Differential Revision: http://reviews.llvm.org/D6295 llvm-svn: 224131
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp b/clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp
new file mode 100644
index 00000000000..9187c1a5a27
--- /dev/null
+++ b/clang/test/CodeGenCXX/mangle-local-anonymous-unions.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
+
+// CHECK-DAG: @_ZZ2f0vE1a
+// CHECK-DAG: @_ZZ2f0vE1c
+// CHECK-DAG: @_ZZ2f0vE1e_0
+inline int f0() {
+ static union {
+ int a;
+ long int b;
+ };
+
+ static union {
+ int c;
+ double d;
+ };
+
+ if (0) {
+ static union {
+ int e;
+ int f;
+ };
+ }
+ static union {
+ int e;
+ int f;
+ };
+
+ return a+c;
+}
+
+inline void nop() {
+ static union {
+ union {
+ };
+ };
+}
+
+int f1 (int a, int c) {
+ nop();
+ return a+c+f0();
+}
+
OpenPOWER on IntegriCloud