1 // RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck %s
2 // RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck -check-prefix=CHECK-GLOBALS %s
3 
4 // __cxa_guard_acquire argument is 64-bit
5 // rdar://11540122
6 struct A {
7   A();
8 };
9 
f()10 void f() {
11   // CHECK: call i32 @__cxa_guard_acquire(i32*
12   static A a;
13 }
14 
15 // ARM64 uses the C++11 definition of POD.
16 // rdar://12650514
17 namespace test1 {
18   // This class is POD in C++11 and cannot have objects allocated in
19   // its tail-padding.
20   struct ABase {};
21   struct A : ABase {
22     int x;
23     char c;
24   };
25 
26   struct B : A {
27     char d;
28   };
29 
test()30   int test() {
31     return sizeof(B);
32   }
33   // CHECK: define i32 @_ZN5test14testEv()
34   // CHECK: ret i32 12
35 }
36 
37 namespace std {
38   class type_info;
39 }
40 
41 // ARM64 uses string comparisons for what would otherwise be
42 // default-visibility weak RTTI.  rdar://12650568
43 namespace test2 {
44   struct A {
45     virtual void foo();
46   };
foo()47   void A::foo() {}
48   // Tested below because these globals get kindof oddly rearranged.
49 
50   struct __attribute__((visibility("hidden"))) B {};
51   const std::type_info &b0 = typeid(B);
52   // CHECK-GLOBALS: @_ZTSN5test21BE = linkonce_odr hidden constant
53   // CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) }
54 
55   const std::type_info &b1 = typeid(B*);
56   // CHECK-GLOBALS: @_ZTSPN5test21BE = linkonce_odr hidden constant
57   // CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast
58 
59   struct C {};
60   const std::type_info &c0 = typeid(C);
61   // CHECK-GLOBALS: @_ZTSN5test21CE = linkonce_odr constant [11 x i8] c"N5test21CE\00"
62   // CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21CE, i32 0, i32 0) }
63 }
64 
65 // va_list should be based on "char *" rather than "void *".
66 
67 // CHECK: define void @_Z11whatsVaListPc
whatsVaList(__builtin_va_list l)68 void whatsVaList(__builtin_va_list l) {}
69