Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / mangle-unnamed.cpp
blobc90f47b26e70a1652fac07a5cf6d8473eb708921
1 // RUN: %clang_cc1 -std=c++98 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
2 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
4 struct S {
5 virtual ~S() { }
6 };
8 // PR5706
9 // Make sure this doesn't crash; the mangling doesn't matter because the name
10 // doesn't have linkage.
11 static struct : S { } obj8;
13 void f() {
14 // Make sure this doesn't crash; the mangling doesn't matter because the
15 // generated vtable/etc. aren't modifiable (although it would be nice for
16 // codesize to make it consistent inside inline functions).
17 static struct : S { } obj8;
20 inline int f2() {
21 // FIXME: We don't mangle the names of a or x correctly!
22 static struct { int a() { static int x; return ++x; } } obj;
23 return obj.a();
26 int f3() { return f2(); }
28 struct A {
29 typedef struct { int x; } *ptr;
30 ptr m;
31 int a() {
32 static struct x {
33 // FIXME: We don't mangle the names of a or x correctly!
34 int a(ptr A::*memp) { static int x; return ++x; }
35 } a;
36 return a.a(&A::m);
40 int f4() { return A().a(); }
42 int f5() {
43 static union {
44 int a;
47 // CHECK: _ZZ2f5vE1a
48 return a;
51 #if __cplusplus <= 199711L
52 int f6() {
53 static union {
54 union {
55 int : 1;
57 int b;
60 // CXX98: _ZZ2f6vE1b
61 return b;
63 #endif
65 int f7() {
66 static union {
67 union {
68 int b;
69 } a;
72 // CHECK: _ZZ2f7vE1a
73 return a.b;
76 // This used to cause an assert because the typedef-for-anonymous-tag
77 // code was trying to claim the enum for the template.
78 enum { T8 };
79 template <class T> struct Test8 {
80 typedef T type;
81 Test8(type t) {} // tested later
83 template <class T> void make_test8(T value) { Test8<T> t(value); }
84 void test8() { make_test8(T8); }
86 // CHECK-LABEL: define internal void @"_ZNV3$_35test9Ev"(
87 typedef volatile struct {
88 void test9() volatile {}
89 } Test9;
90 void test9() {
91 Test9 a;
92 a.test9();
95 // CHECK-LABEL: define internal void @"_ZN5Test8I3$_2EC1ES0_"(