xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/mangle-local-class-names.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // CHECK:  @_ZZ4FUNCvEN4SSSSC1ERKf
4*f4a2713aSLionel Sambuc // CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf
5*f4a2713aSLionel Sambuc // CHECK:  @_ZZ4GORFfEN4SSSSC1ERKf
6*f4a2713aSLionel Sambuc // CHECK: @_ZZ4GORFfEN4SSSSC2E_0RKf
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc void FUNC ()
9*f4a2713aSLionel Sambuc {
10*f4a2713aSLionel Sambuc   {
11*f4a2713aSLionel Sambuc     float IVAR1 ;
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc     struct SSSS
14*f4a2713aSLionel Sambuc     {
15*f4a2713aSLionel Sambuc       float bv;
16*f4a2713aSLionel Sambuc       SSSS( const float& from): bv(from) { }
17*f4a2713aSLionel Sambuc     };
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc     SSSS VAR1(IVAR1);
20*f4a2713aSLionel Sambuc    }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc    {
23*f4a2713aSLionel Sambuc     float IVAR2 ;
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc     struct SSSS
26*f4a2713aSLionel Sambuc     {
27*f4a2713aSLionel Sambuc      SSSS( const float& from) {}
28*f4a2713aSLionel Sambuc     };
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc     SSSS VAR2(IVAR2);
31*f4a2713aSLionel Sambuc    }
32*f4a2713aSLionel Sambuc }
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc void GORF (float IVAR1)
35*f4a2713aSLionel Sambuc {
36*f4a2713aSLionel Sambuc   {
37*f4a2713aSLionel Sambuc     struct SSSS
38*f4a2713aSLionel Sambuc     {
39*f4a2713aSLionel Sambuc       float bv;
40*f4a2713aSLionel Sambuc       SSSS( const float& from): bv(from) { }
41*f4a2713aSLionel Sambuc     };
42*f4a2713aSLionel Sambuc 
43*f4a2713aSLionel Sambuc     SSSS VAR1(IVAR1);
44*f4a2713aSLionel Sambuc    }
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc    {
47*f4a2713aSLionel Sambuc     float IVAR2 ;
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc     struct SSSS
50*f4a2713aSLionel Sambuc     {
51*f4a2713aSLionel Sambuc      SSSS( const float& from) {}
52*f4a2713aSLionel Sambuc     };
53*f4a2713aSLionel Sambuc 
54*f4a2713aSLionel Sambuc     SSSS VAR2(IVAR2);
55*f4a2713aSLionel Sambuc    }
56*f4a2713aSLionel Sambuc }
57*f4a2713aSLionel Sambuc 
58*f4a2713aSLionel Sambuc // CHECK: @_ZZ12OmittingCodefEN4SSSSC1E_0RKf
59*f4a2713aSLionel Sambuc inline void OmittingCode(float x) {
60*f4a2713aSLionel Sambuc   if (0) {
61*f4a2713aSLionel Sambuc     struct SSSS {
62*f4a2713aSLionel Sambuc       float bv;
63*f4a2713aSLionel Sambuc       SSSS(const float& from): bv(from) { }
64*f4a2713aSLionel Sambuc     };
65*f4a2713aSLionel Sambuc 
66*f4a2713aSLionel Sambuc     SSSS VAR1(x);
67*f4a2713aSLionel Sambuc   }
68*f4a2713aSLionel Sambuc 
69*f4a2713aSLionel Sambuc   struct SSSS {
70*f4a2713aSLionel Sambuc     float bv;
71*f4a2713aSLionel Sambuc     SSSS(const float& from): bv(from) { }
72*f4a2713aSLionel Sambuc   };
73*f4a2713aSLionel Sambuc 
74*f4a2713aSLionel Sambuc   SSSS VAR2(x);
75*f4a2713aSLionel Sambuc }
76*f4a2713aSLionel Sambuc void CallOmittingCode() { OmittingCode(1); }
77*f4a2713aSLionel Sambuc 
78*f4a2713aSLionel Sambuc // CHECK: @_ZZ15LocalAnonStructvENUt0_1gEv
79*f4a2713aSLionel Sambuc inline void LocalAnonStruct() {
80*f4a2713aSLionel Sambuc   if (0) {
81*f4a2713aSLionel Sambuc     struct { void f() {} } x;
82*f4a2713aSLionel Sambuc     x.f();
83*f4a2713aSLionel Sambuc   }
84*f4a2713aSLionel Sambuc   struct { void g() {} } y;
85*f4a2713aSLionel Sambuc   y.g();
86*f4a2713aSLionel Sambuc }
87*f4a2713aSLionel Sambuc void CallLocalAnonStruct() { LocalAnonStruct(); }
88