• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3// CHECK: v17@0:8{vector<float, float, float>=}16
4// CHECK: {vector<float, float, float>=}
5// CHECK: v24@0:816
6
7template <typename T1, typename T2, typename T3> struct vector {
8  vector();
9  vector(T1,T2,T3);
10};
11
12typedef vector< float, float, float > vector3f;
13
14@interface SceneNode
15{
16 vector3f position;
17}
18
19@property (assign, nonatomic) vector3f position;
20
21@end
22
23@interface MyOpenGLView
24{
25@public
26  vector3f position;
27}
28@property vector3f position;
29@end
30
31@implementation MyOpenGLView
32
33@synthesize position;
34
35-(void)awakeFromNib {
36 SceneNode *sn;
37 vector3f VF3(1.0, 1.0, 1.0);
38 [sn setPosition:VF3];
39}
40@end
41
42
43class Int3 { int x, y, z; };
44
45// Enforce @encoding for member pointers.
46@interface MemPtr {}
47- (void) foo: (int (Int3::*)) member;
48@end
49@implementation MemPtr
50- (void) foo: (int (Int3::*)) member {
51}
52@end
53
54// rdar: // 8519948
55typedef float HGVec4f __attribute__ ((vector_size(16)));
56
57@interface RedBalloonHGXFormWrapper {
58  HGVec4f m_Transform[4];
59}
60@end
61
62@implementation RedBalloonHGXFormWrapper
63@end
64
65// rdar://9357400
66namespace rdar9357400 {
67  template<int Dim1 = -1, int Dim2 = -1> struct fixed {
68      template<int D> struct rebind { typedef fixed<D> other; };
69  };
70
71  template<typename Element, int Size>
72  class fixed_1D
73  {
74  public:
75      typedef Element value_type;
76      typedef value_type array_impl[Size];
77    protected:
78      array_impl                  m_data;
79  };
80
81  template<typename Element, typename Alloc>
82  class vector;
83
84  template<typename Element, int Size>
85  class vector< Element, fixed<Size> >
86  : public fixed_1D<Element,Size> { };
87
88  typedef vector< float,  fixed<4> > vector4f;
89
90  // CHECK: @_ZN11rdar93574002ggE = constant [49 x i8] c"{vector<float, rdar9357400::fixed<4, -1> >=[4f]}\00"
91  extern const char gg[] = @encode(vector4f);
92}
93
94// rdar://9624314
95namespace rdar9624314 {
96  struct B2 { int x; };
97  struct B3 {};
98  struct S : B2, B3 {};
99
100  // CHECK: @_ZN11rdar96243142ggE = constant [6 x i8] c"{S=i}\00"
101  extern const char gg[] = @encode(S);
102
103  struct S2 { unsigned : 0; int x; unsigned : 0; };
104  // CHECK: @_ZN11rdar96243142g2E = constant [11 x i8] c"{S2=b0ib0}\00"
105  extern const char g2[] = @encode(S2);
106}
107
108namespace test {
109  class Foo {
110  public:
111   virtual void f() {};
112  };
113
114  class Bar {
115  public:
116   virtual void g() {};
117  };
118
119  class Zoo : virtual public Foo, virtual public Bar {
120  public:
121   int x;
122   int y;
123  };
124
125  // CHECK: @_ZN4test3ecdE = constant [15 x i8] c"{Zoo=^^?ii^^?}\00"
126  extern const char ecd[] = @encode(Zoo);
127}
128
129struct Base1 {
130  char x;
131};
132
133struct DBase : public Base1 {
134  double x;
135  virtual ~DBase();
136};
137
138struct Sub_with_virt : virtual DBase {
139  long x;
140};
141
142struct Sub2 : public Sub_with_virt, public Base1, virtual DBase {
143  float x;
144};
145
146// CHECK: @g1 = constant [10 x i8] c"{Base1=c}\00"
147extern const char g1[] = @encode(Base1);
148
149// CHECK: @g2 = constant [14 x i8] c"{DBase=^^?cd}\00"
150extern const char g2[] = @encode(DBase);
151
152// CHECK: @g3 = constant [26 x i8] c"{Sub_with_virt=^^?q^^?cd}\00"
153extern const char g3[] = @encode(Sub_with_virt);
154
155// CHECK: @g4 = constant [19 x i8] c"{Sub2=^^?qcf^^?cd}\00"
156extern const char g4[] = @encode(Sub2);
157
158// http://llvm.org/PR9927
159class allocator {
160};
161class basic_string     {
162struct _Alloc_hider : allocator       {
163char* _M_p;
164};
165_Alloc_hider _M_dataplus;
166};
167
168// CHECK: @g5 = constant [32 x i8] c"{basic_string={_Alloc_hider=*}}\00"
169extern const char g5[] = @encode(basic_string);
170
171
172// PR10990
173class CefBase {
174  virtual ~CefBase() {}
175};
176class CefBrowser : public virtual CefBase {};
177class CefBrowserImpl : public CefBrowser {};
178// CHECK: @g6 = constant [21 x i8] c"{CefBrowserImpl=^^?}\00"
179extern const char g6[] = @encode(CefBrowserImpl);
180
181// PR10990_2
182class CefBase2 {
183  virtual ~CefBase2() {}
184  int i;
185};
186class CefBrowser2 : public virtual CefBase2 {};
187class CefBrowserImpl2 : public CefBrowser2 {};
188// CHECK: @g7 = constant [26 x i8] c"{CefBrowserImpl2=^^?^^?i}\00"
189extern const char g7[] = @encode(CefBrowserImpl2);
190
191// <rdar://problem/11324167>
192struct Empty {};
193
194struct X : Empty {
195  int array[10];
196};
197
198struct Y : Empty {
199  X vec;
200};
201
202// CHECK: @g8 = constant [14 x i8] c"{Y={X=[10i]}}\00"
203extern const char g8[] = @encode(Y);
204
205
206class dynamic_class {
207public:
208  virtual ~dynamic_class();
209};
210@interface has_dynamic_class_ivar
211@end
212@implementation has_dynamic_class_ivar {
213  dynamic_class dynamic_class_ivar;
214}
215@end
216// CHECK: private global [41 x i8] c"{dynamic_class=\22_vptr$dynamic_class\22^^?}\00"
217
218namespace PR17142 {
219  struct A { virtual ~A(); };
220  struct B : virtual A { int y; };
221  struct C { virtual ~C(); int z; };
222  struct D : C, B { int a; };
223  struct E : D {};
224  // CHECK: @_ZN7PR171421xE = constant [14 x i8] c"{E=^^?i^^?ii}\00"
225  extern const char x[] = @encode(E);
226}
227