Updated to Clang 3.5a.
Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
diff --git a/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp b/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp
index 3e53397..a70f6e0 100644
--- a/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp
+++ b/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm %s -o -
struct CallSite {
diff --git a/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp
index a6e2e30..a4411fc 100644
--- a/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp
+++ b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm %s -o -
struct A {
virtual void Method() = 0;
diff --git a/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp
index 5d8c8b0..03c4ed6 100644
--- a/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp
+++ b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
// CHECK: _ZN11AccessFlags6strlenEv
struct AccessFlags {
diff --git a/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp
index bd270dd..c5a2d5a 100644
--- a/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp
+++ b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm -o - %s
struct A {
virtual ~A();
diff --git a/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp b/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp
index fe0740b..bf00c0f 100644
--- a/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp
+++ b/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
// CHECK-NOT: ZN12basic_stringIcEC1Ev
// CHECK: ZN12basic_stringIcED1Ev
diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
index a1b05eb..ce6cc0e 100644
--- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp
+++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
struct A { A(const A&, int i1 = 1); };
@@ -12,8 +11,4 @@
return b;
}
-// CHECK-LP64: callq __ZN1AC1ERKS_i
-
-// CHECK-LP32: calll L__ZN1AC1ERKS_i
-
-
+// CHECK: call void @_ZN1AC1ERKS_i
diff --git a/test/CodeGenCXX/PR5093-static-member-function.cpp b/test/CodeGenCXX/PR5093-static-member-function.cpp
index ceab852..d61a87a 100644
--- a/test/CodeGenCXX/PR5093-static-member-function.cpp
+++ b/test/CodeGenCXX/PR5093-static-member-function.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
struct a {
static void f();
};
diff --git a/test/CodeGenCXX/PR5863-unreachable-block.cpp b/test/CodeGenCXX/PR5863-unreachable-block.cpp
index 3f32d75..50d1731 100644
--- a/test/CodeGenCXX/PR5863-unreachable-block.cpp
+++ b/test/CodeGenCXX/PR5863-unreachable-block.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm-only %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -emit-llvm-only %s
// PR5863
class E { };
diff --git a/test/CodeGenCXX/aarch64-mangle-neon-vectors.cpp b/test/CodeGenCXX/aarch64-mangle-neon-vectors.cpp
index 2514704..e54975d 100644
--- a/test/CodeGenCXX/aarch64-mangle-neon-vectors.cpp
+++ b/test/CodeGenCXX/aarch64-mangle-neon-vectors.cpp
@@ -5,8 +5,8 @@
typedef unsigned short uint16_t;
typedef signed char int8_t;
typedef signed short int16_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
+typedef signed long int64_t;
+typedef unsigned long uint64_t;
typedef unsigned char poly8_t;
typedef unsigned short poly16_t;
typedef __fp16 float16_t;
diff --git a/test/CodeGenCXX/abstract-class-ctors-dtors.cpp b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp
index 793bbde..f369224 100644
--- a/test/CodeGenCXX/abstract-class-ctors-dtors.cpp
+++ b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp
@@ -7,10 +7,10 @@
~A();
};
-// CHECK-NOT-LABEL: define void @_ZN1AC1Ev
+// CHECK-NOT: define void @_ZN1AC1Ev
// CHECK-LABEL: define void @_ZN1AC2Ev
-// CHECK-LABEL: define void @_ZN1AD1Ev
// CHECK-LABEL: define void @_ZN1AD2Ev
+// CHECK-LABEL: define void @_ZN1AD1Ev
A::A() { }
A::~A() { }
diff --git a/test/CodeGenCXX/address-of-fntemplate.cpp b/test/CodeGenCXX/address-of-fntemplate.cpp
index 7179452..4ff597a 100644
--- a/test/CodeGenCXX/address-of-fntemplate.cpp
+++ b/test/CodeGenCXX/address-of-fntemplate.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
template <typename T> void f(T) {}
template <typename T> void f() { }
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
index 2fb9c49..2790199 100644
--- a/test/CodeGenCXX/arm.cpp
+++ b/test/CodeGenCXX/arm.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios3.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
// CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4
// CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0
diff --git a/test/CodeGenCXX/arm64-constructor-return.cpp b/test/CodeGenCXX/arm64-constructor-return.cpp
new file mode 100644
index 0000000..0d5b3b3
--- /dev/null
+++ b/test/CodeGenCXX/arm64-constructor-return.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 %s -triple=arm64-apple-ios7.0.0 -emit-llvm -o - | FileCheck %s
+// rdar://12162905
+
+struct S {
+ S();
+ int iField;
+};
+
+S::S() {
+ iField = 1;
+};
+
+// CHECK: %struct.S* @_ZN1SC2Ev(%struct.S* returned %this)
+
+// CHECK: %struct.S* @_ZN1SC1Ev(%struct.S* returned %this)
+// CHECK: [[THISADDR:%[a-zA-z0-9.]+]] = alloca %struct.S*
+// CHECK: store %struct.S* %this, %struct.S** [[THISADDR]]
+// CHECK: [[THIS1:%.*]] = load %struct.S** [[THISADDR]]
+// CHECK: ret %struct.S* [[THIS1]]
diff --git a/test/CodeGenCXX/arm64-darwinpcs.cpp b/test/CodeGenCXX/arm64-darwinpcs.cpp
new file mode 100644
index 0000000..0a0ec3a
--- /dev/null
+++ b/test/CodeGenCXX/arm64-darwinpcs.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple arm64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-linux-gnu -emit-llvm -o - %s -target-abi darwinpcs | FileCheck %s --check-prefix=CHECK-DARWIN
+
+void test_extensions(bool a, char b, short c) {}
+// CHECK: define void @_Z15test_extensionsbcs(i1 %a, i8 %b, i16 %c)
+// CHECK-DARWIN: define void @_Z15test_extensionsbcs(i1 zeroext %a, i8 signext %b, i16 signext %c)
+
+struct Empty {};
+void test_empty(Empty e) {}
+// CHECK: define void @_Z10test_empty5Empty(i8
+// CHECK-DARWIN: define void @_Z10test_empty5Empty()
+
+struct HFA {
+ float a[3];
+};
diff --git a/test/CodeGenCXX/arm64-empty-struct.cpp b/test/CodeGenCXX/arm64-empty-struct.cpp
new file mode 100644
index 0000000..6fa4e95
--- /dev/null
+++ b/test/CodeGenCXX/arm64-empty-struct.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -target-abi darwinpcs -emit-llvm -o - %s | FileCheck %s
+struct Empty {};
+
+Empty emptyvar;
+
+int take_args(int a, ...) {
+ __builtin_va_list l;
+ __builtin_va_start(l, a);
+// CHECK: call void @llvm.va_start
+
+ emptyvar = __builtin_va_arg(l, Empty);
+// CHECK: load i8**
+// CHECK-NOT: getelementptr
+// CHECK: [[EMPTY_PTR:%[a-zA-Z0-9._]+]] = bitcast i8* {{%[a-zA-Z0-9._]+}} to %struct.Empty*
+
+ // It's conceivable that EMPTY_PTR may not actually be a valid pointer
+ // (e.g. it's at the very bottom of the stack and the next page is
+ // invalid). This doesn't matter provided it's never loaded (there's no
+ // well-defined way to tell), but it becomes a problem if we do try to use it.
+// CHECK-NOT: load %struct.Empty* [[EMPTY_PTR]]
+
+ int i = __builtin_va_arg(l, int);
+// CHECK: va_arg i8** {{%[a-zA-Z0-9._]+}}, i32
+
+ __builtin_va_end(l);
+ return i;
+}
diff --git a/test/CodeGenCXX/arm64.cpp b/test/CodeGenCXX/arm64.cpp
new file mode 100644
index 0000000..d0d4f4f
--- /dev/null
+++ b/test/CodeGenCXX/arm64.cpp
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=arm64-apple-ios -emit-llvm -o - | FileCheck -check-prefix=CHECK-GLOBALS %s
+
+// __cxa_guard_acquire argument is 64-bit
+// rdar://11540122
+struct A {
+ A();
+};
+
+void f() {
+ // CHECK: call i32 @__cxa_guard_acquire(i64*
+ static A a;
+}
+
+// ARM64 uses the C++11 definition of POD.
+// rdar://12650514
+namespace test1 {
+ // This class is POD in C++11 and cannot have objects allocated in
+ // its tail-padding.
+ struct ABase {};
+ struct A : ABase {
+ int x;
+ char c;
+ };
+
+ struct B : A {
+ char d;
+ };
+
+ int test() {
+ return sizeof(B);
+ }
+ // CHECK: define i32 @_ZN5test14testEv()
+ // CHECK: ret i32 12
+}
+
+namespace std {
+ class type_info;
+}
+
+// ARM64 uses string comparisons for what would otherwise be
+// default-visibility weak RTTI. rdar://12650568
+namespace test2 {
+ struct A {
+ virtual void foo();
+ };
+ void A::foo() {}
+ // Tested below because these globals get kindof oddly rearranged.
+
+ struct __attribute__((visibility("hidden"))) B {};
+ const std::type_info &b0 = typeid(B);
+ // CHECK-GLOBALS: @_ZTSN5test21BE = linkonce_odr hidden constant
+ // CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) }
+
+ const std::type_info &b1 = typeid(B*);
+ // CHECK-GLOBALS: @_ZTSPN5test21BE = linkonce_odr hidden constant
+ // CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast
+
+ struct C {};
+ const std::type_info &c0 = typeid(C);
+ // CHECK-GLOBALS: @_ZTSN5test21CE = linkonce_odr hidden constant
+ // CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([11 x i8]* @_ZTSN5test21CE to i64), i64 -9223372036854775808) to i8*) }
+
+ const std::type_info &c1 = typeid(C*);
+ // CHECK-GLOBALS: @_ZTSPN5test21CE = linkonce_odr hidden constant
+ // CHECK-GLOBALS: @_ZTIPN5test21CE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([12 x i8]* @_ZTSPN5test21CE to i64), i64 -9223372036854775808) to i8*), i32 0, i8* bitcast
+
+ // This class is explicitly-instantiated, but that instantiation
+ // doesn't guarantee to emit RTTI, so we can still demote the visibility.
+ template <class T> class D {};
+ template class D<int>;
+ const std::type_info &d0 = typeid(D<int>);
+ // CHECK-GLOBALS: @_ZTSN5test21DIiEE = linkonce_odr hidden constant
+ // CHECK-GLOBALS: @_ZTIN5test21DIiEE = linkonce_odr hidden constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([14 x i8]* @_ZTSN5test21DIiEE to i64), i64 -9223372036854775808) to i8*) }
+
+ // This class is explicitly-instantiated and *does* guarantee to
+ // emit RTTI, so we're stuck with having to use default visibility.
+ template <class T> class E {
+ virtual void foo() {}
+ };
+ template class E<int>;
+ // CHECK-GLOBALS: @_ZTSN5test21EIiEE = weak_odr constant [14 x i8]
+ // CHECK-GLOBALS: @_ZTIN5test21EIiEE = weak_odr constant { {{.*}}, i8* inttoptr (i64 add (i64 ptrtoint ([14 x i8]* @_ZTSN5test21EIiEE to i64), i64 -9223372036854775808) to i8*) }
+
+ // CHECK-GLOBALS: @_ZTSN5test21AE = constant [11 x i8]
+ // CHECK-GLOBALS: @_ZTIN5test21AE = constant { {{.*}}, i8* getelementptr inbounds ([11 x i8]* @_ZTSN5test21AE, i32 0, i32 0) }
+
+}
diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp
index 645ad1d..53b81f2 100644
--- a/test/CodeGenCXX/array-construction.cpp
+++ b/test/CodeGenCXX/array-construction.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -31,7 +30,4 @@
h, i, j, array[h][i][j].i, array[h][i][j].f);
}
-// CHECK-LP64: callq __ZN4xptoC1Ev
-
-// CHECK-LP32: calll L__ZN4xptoC1Ev
-
+// CHECK: call void @_ZN4xptoC1Ev
diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp
index 8d6f50f..890b142 100644
--- a/test/CodeGenCXX/array-operator-delete-call.cpp
+++ b/test/CodeGenCXX/array-operator-delete-call.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -58,7 +57,5 @@
}
COST c2;
-// CHECK-LP64: callq __ZdaPv
-
-// CHECK-LP32: calll L__ZdaPv
+// CHECK: call void @_ZdaPv
diff --git a/test/CodeGenCXX/attr-cleanup.cpp b/test/CodeGenCXX/attr-cleanup.cpp
index ff15b03..18a7798 100644
--- a/test/CodeGenCXX/attr-cleanup.cpp
+++ b/test/CodeGenCXX/attr-cleanup.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
namespace N {
void free(void *i) {}
diff --git a/test/CodeGenCXX/attr-used.cpp b/test/CodeGenCXX/attr-used.cpp
index 2c82184..86dd6b9 100644
--- a/test/CodeGenCXX/attr-used.cpp
+++ b/test/CodeGenCXX/attr-used.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
// <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors
struct X0 {
diff --git a/test/CodeGenCXX/bitfield-layout.cpp b/test/CodeGenCXX/bitfield-layout.cpp
index 646300a..46f4111 100644
--- a/test/CodeGenCXX/bitfield-layout.cpp
+++ b/test/CodeGenCXX/bitfield-layout.cpp
@@ -12,7 +12,7 @@
int : 6;
} t2;
-// CHECK-LP64: %union.Test3 = type { [2 x i8] }
+// CHECK-LP64: %union.Test3 = type { i16 }
union Test3 {
int : 9;
} t3;
diff --git a/test/CodeGenCXX/bitfield.cpp b/test/CodeGenCXX/bitfield.cpp
index 2c454b0..fafeffe 100644
--- a/test/CodeGenCXX/bitfield.cpp
+++ b/test/CodeGenCXX/bitfield.cpp
@@ -298,7 +298,7 @@
#endif
unsigned read(Base* s) {
// FIXME: We should widen this load as long as the function isn't being
- // instrumented by thread-sanitizer.
+ // instrumented by ThreadSanitizer.
//
// CHECK-X86-64-LABEL: define i32 @_ZN2N44read
// CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}* %{{.*}}, i32 0, i32 1
@@ -378,8 +378,8 @@
// Zero-length bitfields partition the memory locations of bitfields for the
// purposes of the memory model. That means stores must not span zero-length
// bitfields and loads may only span them when we are not instrumenting with
- // thread sanitizer.
- // FIXME: We currently don't widen loads even without thread sanitizer, even
+ // ThreadSanitizer.
+ // FIXME: We currently don't widen loads even without ThreadSanitizer, even
// though we could.
struct S {
unsigned b1 : 24;
@@ -426,3 +426,55 @@
s->b2 = x;
}
}
+
+namespace N7 {
+ // Similar to N4 except that this adds a virtual base to the picture. (PR18430)
+ // Do NOT widen loads and stores to bitfields into padding at the end of
+ // a class which might end up with members inside of it when inside a derived
+ // class.
+ struct B1 {
+ virtual void f();
+ unsigned b1 : 24;
+ };
+ struct B2 : virtual B1 {
+ virtual ~B2();
+ unsigned b : 24;
+ };
+ // Imagine some other translation unit introduces:
+#if 0
+ struct Derived : public B2 {
+ char c;
+ };
+#endif
+ unsigned read(B2* s) {
+ // FIXME: We should widen this load as long as the function isn't being
+ // instrumented by ThreadSanitizer.
+ //
+ // CHECK-X86-64-LABEL: define i32 @_ZN2N74read
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-X86-64: %[[val:.*]] = load i24* %[[ptr]]
+ // CHECK-X86-64: %[[ext:.*]] = zext i24 %[[val]] to i32
+ // CHECK-X86-64: ret i32 %[[ext]]
+ // CHECK-PPC64-LABEL: define zeroext i32 @_ZN2N74read
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-PPC64: %[[val:.*]] = load i24* %[[ptr]]
+ // CHECK-PPC64: %[[ext:.*]] = zext i24 %[[val]] to i32
+ // CHECK-PPC64: ret i32 %[[ext]]
+ return s->b;
+ }
+ void write(B2* s, unsigned x) {
+ // CHECK-X86-64-LABEL: define void @_ZN2N75write
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-X86-64: %[[new:.*]] = trunc i32 %{{.*}} to i24
+ // CHECK-X86-64: store i24 %[[new]], i24* %[[ptr]]
+ // CHECK-PPC64-LABEL: define void @_ZN2N75write
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-PPC64: %[[new:.*]] = trunc i32 %{{.*}} to i24
+ // CHECK-PPC64: store i24 %[[new]], i24* %[[ptr]]
+ s->b = x;
+ }
+}
diff --git a/test/CodeGenCXX/block-byref-cxx-objc.cpp b/test/CodeGenCXX/block-byref-cxx-objc.cpp
index 616fd67..5c35ad7 100644
--- a/test/CodeGenCXX/block-byref-cxx-objc.cpp
+++ b/test/CodeGenCXX/block-byref-cxx-objc.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - -fblocks | FileCheck %s
// rdar://8594790
struct A {
diff --git a/test/CodeGenCXX/block-in-ctor-dtor.cpp b/test/CodeGenCXX/block-in-ctor-dtor.cpp
index bd37d44..0dc0ab0 100644
--- a/test/CodeGenCXX/block-in-ctor-dtor.cpp
+++ b/test/CodeGenCXX/block-in-ctor-dtor.cpp
@@ -40,9 +40,9 @@
// CHECK-LABEL: define internal void @___ZN4ZoneC2Ev_block_invoke_
// CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke
// CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke_
-// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke
-// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke_
// CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke
// CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke_
+// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke
+// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke_
// CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke
// CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke_
diff --git a/test/CodeGenCXX/block.cpp b/test/CodeGenCXX/block.cpp
index 619d8b0..aa35668 100644
--- a/test/CodeGenCXX/block.cpp
+++ b/test/CodeGenCXX/block.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - -fblocks
+// RUN: %clang_cc1 %s -triple %ms_abi_triple -fno-rtti -emit-llvm -o - -fblocks
// Just test that this doesn't crash the compiler...
void func(void*);
diff --git a/test/CodeGenCXX/c-linkage.cpp b/test/CodeGenCXX/c-linkage.cpp
index 1607623..2f8729e 100644
--- a/test/CodeGenCXX/c-linkage.cpp
+++ b/test/CodeGenCXX/c-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
// pr6644
extern "C" {
@@ -10,7 +10,7 @@
}
}
-// CHECK-LABEL: define void @_ZN1N1X1fEv
+// CHECK-LABEL: define {{.*}}void @_ZN1N1X1fEv
extern "C" {
static void test2_f() {
diff --git a/test/CodeGenCXX/call-arg-zero-temp.cpp b/test/CodeGenCXX/call-arg-zero-temp.cpp
index 14238f2..beef2fd 100644
--- a/test/CodeGenCXX/call-arg-zero-temp.cpp
+++ b/test/CodeGenCXX/call-arg-zero-temp.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
+// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
diff --git a/test/CodeGenCXX/captured-statements.cpp b/test/CodeGenCXX/captured-statements.cpp
index 2843c2b6..fb35446 100644
--- a/test/CodeGenCXX/captured-statements.cpp
+++ b/test/CodeGenCXX/captured-statements.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3
diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp
index 5565f65..ce8f820 100644
--- a/test/CodeGenCXX/cast-conversion.cpp
+++ b/test/CodeGenCXX/cast-conversion.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
struct A {
A(int);
@@ -18,16 +17,9 @@
static_cast<B>(10);
}
-// CHECK-LP64: callq __ZN1AC1Ei
-// CHECK-LP64: callq __ZN1BC1E1A
-// CHECK-LP64: callq __ZN1AC1Ei
-// CHECK-LP64: callq __ZN1BC1E1A
-// CHECK-LP64: callq __ZN1AC1Ei
-// CHECK-LP64: callq __ZN1BC1E1A
-
-// CHECK-LP32: calll L__ZN1AC1Ei
-// CHECK-LP32: calll L__ZN1BC1E1A
-// CHECK-LP32: calll L__ZN1AC1Ei
-// CHECK-LP32: calll L__ZN1BC1E1A
-// CHECK-LP32: calll L__ZN1AC1Ei
-// CHECK-LP32: calll L__ZN1BC1E1A
+// CHECK: call void @_ZN1AC1Ei
+// CHECK: call void @_ZN1BC1E1A
+// CHECK: call void @_ZN1AC1Ei
+// CHECK: call void @_ZN1BC1E1A
+// CHECK: call void @_ZN1AC1Ei
+// CHECK: call void @_ZN1BC1E1A
diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp
index 21e1a2b..1f62129 100644
--- a/test/CodeGenCXX/class-layout.cpp
+++ b/test/CodeGenCXX/class-layout.cpp
@@ -39,7 +39,7 @@
char a;
};
- // CHECK: %"struct.Test5::B" = type { [9 x i8], i8, i8, [5 x i8] }
+ // CHECK: %"struct.Test5::B" = type { %"struct.Test5::A.base", i8, i8, [5 x i8] }
struct B : A {
char b : 1;
char c;
diff --git a/test/CodeGenCXX/const-base-cast.cpp b/test/CodeGenCXX/const-base-cast.cpp
index 320c790..dd980d5 100644
--- a/test/CodeGenCXX/const-base-cast.cpp
+++ b/test/CodeGenCXX/const-base-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
// Check that the following construct, which is similar to one which occurs
// in Firefox, is folded correctly.
diff --git a/test/CodeGenCXX/const-global-linkage.cpp b/test/CodeGenCXX/const-global-linkage.cpp
index df78fdd..e1e9321 100644
--- a/test/CodeGenCXX/const-global-linkage.cpp
+++ b/test/CodeGenCXX/const-global-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
const int x = 10;
const int y = 20;
diff --git a/test/CodeGenCXX/const-init-cxx1y.cpp b/test/CodeGenCXX/const-init-cxx1y.cpp
index 978c428..5dd15a3 100644
--- a/test/CodeGenCXX/const-init-cxx1y.cpp
+++ b/test/CodeGenCXX/const-init-cxx1y.cpp
@@ -1,4 +1,5 @@
-// RUN: not %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++1y | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++1y | FileCheck %s
+// expected-no-diagnostics
struct A {
constexpr A() : n(1) {}
diff --git a/test/CodeGenCXX/constructor-attr.cpp b/test/CodeGenCXX/constructor-attr.cpp
index 4f6d635..468ce36 100644
--- a/test/CodeGenCXX/constructor-attr.cpp
+++ b/test/CodeGenCXX/constructor-attr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
// CHECK: @llvm.global_ctors
diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp
index ebb414d..bace54f 100644
--- a/test/CodeGenCXX/constructor-conversion.cpp
+++ b/test/CodeGenCXX/constructor-conversion.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -46,10 +45,6 @@
g(3); // g(X(3))
}
-// CHECK-LP64: callq __ZN1XC1Ei
-// CHECK-LP64: callq __ZN1XC1EPKci
-// CHECK-LP64: callq __ZN1XC1Ev
-
-// CHECK-LP32: calll L__ZN1XC1Ei
-// CHECK-LP32: calll L__ZN1XC1EPKci
-// CHECK-LP32: calll L__ZN1XC1Ev
+// CHECK: call void @_ZN1XC1Ei
+// CHECK: call void @_ZN1XC1EPKci
+// CHECK: call void @_ZN1XC1Ev
diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp
index c2cf44c..98a5864 100644
--- a/test/CodeGenCXX/constructor-default-arg.cpp
+++ b/test/CodeGenCXX/constructor-default-arg.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -31,10 +30,6 @@
X d(a, 5, 6);
}
-// CHECK-LP64: callq __ZN1XC1ERKS_iii
-// CHECK-LP64: callq __ZN1XC1ERKS_iii
-// CHECK-LP64: callq __ZN1XC1ERKS_iii
-
-// CHECK-LP32: calll L__ZN1XC1ERKS_iii
-// CHECK-LP32: calll L__ZN1XC1ERKS_iii
-// CHECK-LP32: calll L__ZN1XC1ERKS_iii
+// CHECK: call void @_ZN1XC1ERKS_iii
+// CHECK: call void @_ZN1XC1ERKS_iii
+// CHECK: call void @_ZN1XC1ERKS_iii
diff --git a/test/CodeGenCXX/constructor-destructor-return-this.cpp b/test/CodeGenCXX/constructor-destructor-return-this.cpp
index ea2ea45..ce6ddd2 100644
--- a/test/CodeGenCXX/constructor-destructor-return-this.cpp
+++ b/test/CodeGenCXX/constructor-destructor-return-this.cpp
@@ -1,6 +1,7 @@
//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-unknown-linux | FileCheck --check-prefix=CHECKGEN %s
-//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios3.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKARM %s
-//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-pc-win32 -cxx-abi microsoft -fno-rtti | FileCheck --check-prefix=CHECKMS %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios6.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKARM %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios5.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKIOS5 %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-pc-win32 -fno-rtti | FileCheck --check-prefix=CHECKMS %s
// FIXME: these tests crash on the bots when run with -triple=x86_64-pc-win32
// Make sure we attach the 'returned' attribute to the 'this' parameter of
@@ -27,15 +28,20 @@
B::B(int *i) : i_(i) { }
B::~B() { }
-// CHECKGEN-LABEL: define void @_ZN1BC1EPi(%class.B* %this, i32* %i)
// CHECKGEN-LABEL: define void @_ZN1BC2EPi(%class.B* %this, i32* %i)
-// CHECKGEN-LABEL: define void @_ZN1BD1Ev(%class.B* %this)
+// CHECKGEN-LABEL: define void @_ZN1BC1EPi(%class.B* %this, i32* %i)
// CHECKGEN-LABEL: define void @_ZN1BD2Ev(%class.B* %this)
+// CHECKGEN-LABEL: define void @_ZN1BD1Ev(%class.B* %this)
-// CHECKARM-LABEL: define %class.B* @_ZN1BC1EPi(%class.B* returned %this, i32* %i)
// CHECKARM-LABEL: define %class.B* @_ZN1BC2EPi(%class.B* returned %this, i32* %i)
-// CHECKARM-LABEL: define %class.B* @_ZN1BD1Ev(%class.B* returned %this)
+// CHECKARM-LABEL: define %class.B* @_ZN1BC1EPi(%class.B* returned %this, i32* %i)
// CHECKARM-LABEL: define %class.B* @_ZN1BD2Ev(%class.B* returned %this)
+// CHECKARM-LABEL: define %class.B* @_ZN1BD1Ev(%class.B* returned %this)
+
+// CHECKIOS5-LABEL: define %class.B* @_ZN1BC2EPi(%class.B* %this, i32* %i)
+// CHECKIOS5-LABEL: define %class.B* @_ZN1BC1EPi(%class.B* %this, i32* %i)
+// CHECKIOS5-LABEL: define %class.B* @_ZN1BD2Ev(%class.B* %this)
+// CHECKIOS5-LABEL: define %class.B* @_ZN1BD1Ev(%class.B* %this)
// CHECKMS-LABEL: define x86_thiscallcc %class.B* @"\01??0B@@QAE@PAH@Z"(%class.B* returned %this, i32* %i)
// CHECKMS-LABEL: define x86_thiscallcc void @"\01??1B@@QAE@XZ"(%class.B* %this)
@@ -51,17 +57,23 @@
C::C(int *i, char *c) : B(i), c_(c) { }
C::~C() { }
-// CHECKGEN-LABEL: define void @_ZN1CC1EPiPc(%class.C* %this, i32* %i, i8* %c)
// CHECKGEN-LABEL: define void @_ZN1CC2EPiPc(%class.C* %this, i32* %i, i8* %c)
-// CHECKGEN-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
-// CHECKGEN-LABEL: define void @_ZN1CD1Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CC1EPiPc(%class.C* %this, i32* %i, i8* %c)
// CHECKGEN-LABEL: define void @_ZN1CD2Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CD1Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
-// CHECKARM-LABEL: define %class.C* @_ZN1CC1EPiPc(%class.C* returned %this, i32* %i, i8* %c)
// CHECKARM-LABEL: define %class.C* @_ZN1CC2EPiPc(%class.C* returned %this, i32* %i, i8* %c)
-// CHECKARM-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
-// CHECKARM-LABEL: define %class.C* @_ZN1CD1Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define %class.C* @_ZN1CC1EPiPc(%class.C* returned %this, i32* %i, i8* %c)
// CHECKARM-LABEL: define %class.C* @_ZN1CD2Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define %class.C* @_ZN1CD1Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
+
+// CHECKIOS5-LABEL: define %class.C* @_ZN1CC2EPiPc(%class.C* %this, i32* %i, i8* %c)
+// CHECKIOS5-LABEL: define %class.C* @_ZN1CC1EPiPc(%class.C* %this, i32* %i, i8* %c)
+// CHECKIOS5-LABEL: define %class.C* @_ZN1CD2Ev(%class.C* %this)
+// CHECKIOS5-LABEL: define %class.C* @_ZN1CD1Ev(%class.C* %this)
+// CHECKIOS5-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
// CHECKMS-LABEL: define x86_thiscallcc %class.C* @"\01??0C@@QAE@PAHPAD@Z"(%class.C* returned %this, i32* %i, i8* %c)
// CHECKMS-LABEL: define x86_thiscallcc void @"\01??1C@@UAE@XZ"(%class.C* %this)
@@ -75,15 +87,20 @@
D::D() { }
D::~D() { }
-// CHECKGEN-LABEL: define void @_ZN1DC1Ev(%class.D* %this)
// CHECKGEN-LABEL: define void @_ZN1DC2Ev(%class.D* %this, i8** %vtt)
-// CHECKGEN-LABEL: define void @_ZN1DD1Ev(%class.D* %this)
+// CHECKGEN-LABEL: define void @_ZN1DC1Ev(%class.D* %this)
// CHECKGEN-LABEL: define void @_ZN1DD2Ev(%class.D* %this, i8** %vtt)
+// CHECKGEN-LABEL: define void @_ZN1DD1Ev(%class.D* %this)
-// CHECKARM-LABEL: define %class.D* @_ZN1DC1Ev(%class.D* returned %this)
// CHECKARM-LABEL: define %class.D* @_ZN1DC2Ev(%class.D* returned %this, i8** %vtt)
-// CHECKARM-LABEL: define %class.D* @_ZN1DD1Ev(%class.D* returned %this)
+// CHECKARM-LABEL: define %class.D* @_ZN1DC1Ev(%class.D* returned %this)
// CHECKARM-LABEL: define %class.D* @_ZN1DD2Ev(%class.D* returned %this, i8** %vtt)
+// CHECKARM-LABEL: define %class.D* @_ZN1DD1Ev(%class.D* returned %this)
+
+// CHECKIOS5-LABEL: define %class.D* @_ZN1DC2Ev(%class.D* %this, i8** %vtt)
+// CHECKIOS5-LABEL: define %class.D* @_ZN1DC1Ev(%class.D* %this)
+// CHECKIOS5-LABEL: define %class.D* @_ZN1DD2Ev(%class.D* %this, i8** %vtt)
+// CHECKIOS5-LABEL: define %class.D* @_ZN1DD1Ev(%class.D* %this)
// CHECKMS-LABEL: define x86_thiscallcc %class.D* @"\01??0D@@QAE@XZ"(%class.D* returned %this, i32 %is_most_derived)
// CHECKMS-LABEL: define x86_thiscallcc void @"\01??1D@@QAE@XZ"(%class.D* %this)
diff --git a/test/CodeGenCXX/constructor-direct-call.cpp b/test/CodeGenCXX/constructor-direct-call.cpp
index 75e6f21..7a2a600 100644
--- a/test/CodeGenCXX/constructor-direct-call.cpp
+++ b/test/CodeGenCXX/constructor-direct-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s
class Test1 {
public:
@@ -22,10 +22,10 @@
void f2() {
// CHECK: %var = alloca %class.Test2, align 4
- // CHECK-NEXT: call void @_ZN5Test2C1Ev(%class.Test2* %var)
+ // CHECK-NEXT: call x86_thiscallcc void @_ZN5Test2C1Ev(%class.Test2* %var)
Test2 var;
- // CHECK-NEXT: call void @_ZN5Test2C1Ev(%class.Test2* %var)
+ // CHECK-NEXT: call x86_thiscallcc void @_ZN5Test2C1Ev(%class.Test2* %var)
var.Test2::Test2();
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 8, i32 4, i1 false)
@@ -45,16 +45,16 @@
};
void f3() {
- // CHECK: call void @_ZN5Test3C1Ev(%class.Test3* %var)
+ // CHECK: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var)
Test3 var;
- // CHECK-NEXT: call void @_ZN5Test3C1Ev(%class.Test3* %var2)
+ // CHECK-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var2)
Test3 var2;
- // CHECK-NEXT: call void @_ZN5Test3C1Ev(%class.Test3* %var)
+ // CHECK-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var)
var.Test3::Test3();
- // CHECK-NEXT: call void @_ZN5Test3C1ERKS_(%class.Test3* %var, %class.Test3* %var2)
+ // CHECK-NEXT: call x86_thiscallcc void @_ZN5Test3C1ERKS_(%class.Test3* %var, %class.Test3* %var2)
var.Test3::Test3(var2);
}
diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp
index 7842d9c..8ea7eac 100644
--- a/test/CodeGenCXX/constructor-for-array-members.cpp
+++ b/test/CodeGenCXX/constructor-for-array-members.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -39,6 +38,4 @@
m1.pr();
}
-// CHECK-LP64: callq __ZN1SC1Ev
-
-// CHECK-LP32: calll L__ZN1SC1Ev
+// CHECK: call void @_ZN1SC1Ev
diff --git a/test/CodeGenCXX/constructor-init-reference.cpp b/test/CodeGenCXX/constructor-init-reference.cpp
index 5e75159..61f426d 100644
--- a/test/CodeGenCXX/constructor-init-reference.cpp
+++ b/test/CodeGenCXX/constructor-init-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | grep "store i32\* @x, i32\*\*"
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
int x;
struct A {
@@ -6,4 +6,4 @@
A() : y(x) {}
};
A z;
-
+// CHECK: store i32* @x, i32**
diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp
index 0d38d10..675e3cf 100644
--- a/test/CodeGenCXX/constructor-template.cpp
+++ b/test/CodeGenCXX/constructor-template.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
+// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
diff --git a/test/CodeGenCXX/constructors.cpp b/test/CodeGenCXX/constructors.cpp
index f730b9e..02c28c7 100644
--- a/test/CodeGenCXX/constructors.cpp
+++ b/test/CodeGenCXX/constructors.cpp
@@ -21,20 +21,19 @@
A::A(struct Undeclared &ref) : mem(0) {}
// Check that delegation works.
-// CHECK-LABEL: define void @_ZN1AC1ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
-// CHECK: call void @_ZN1AC2ER10Undeclared(
-
// CHECK-LABEL: define void @_ZN1AC2ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN6MemberC1Ei(
-A::A(ValueClass v) : mem(v.y - v.x) {}
+// CHECK-LABEL: define void @_ZN1AC1ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
+// CHECK: call void @_ZN1AC2ER10Undeclared(
-// CHECK-LABEL: define void @_ZN1AC1E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
-// CHECK: call void @_ZN1AC2E10ValueClass(
+A::A(ValueClass v) : mem(v.y - v.x) {}
// CHECK-LABEL: define void @_ZN1AC2E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
// CHECK: call void @_ZN6MemberC1Ei(
+// CHECK-LABEL: define void @_ZN1AC1E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
+// CHECK: call void @_ZN1AC2E10ValueClass(
/* Test that things work for inheritance. */
struct B : A {
@@ -44,13 +43,12 @@
B::B(struct Undeclared &ref) : A(ref), mem(1) {}
-// CHECK-LABEL: define void @_ZN1BC1ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
-// CHECK: call void @_ZN1BC2ER10Undeclared(
-
// CHECK-LABEL: define void @_ZN1BC2ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN1AC2ER10Undeclared(
// CHECK: call void @_ZN6MemberC1Ei(
+// CHECK-LABEL: define void @_ZN1BC1ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
+// CHECK: call void @_ZN1BC2ER10Undeclared(
/* Test that the delegation optimization is disabled for classes with
@@ -64,15 +62,14 @@
};
C::C(int x) : A(ValueClass(x, x+1)), mem(x * x) {}
+// CHECK-LABEL: define void @_ZN1CC2Ei(%struct.C* %this, i8** %vtt, i32 %x) unnamed_addr
+// CHECK: call void @_ZN6MemberC1Ei(
+
// CHECK-LABEL: define void @_ZN1CC1Ei(%struct.C* %this, i32 %x) unnamed_addr
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
-// CHECK-LABEL: define void @_ZN1CC2Ei(%struct.C* %this, i8** %vtt, i32 %x) unnamed_addr
-// CHECK: call void @_ZN6MemberC1Ei(
-
-
/* Test that the delegation optimization is disabled for varargs
constructors. */
@@ -83,16 +80,15 @@
D::D(int x, ...) : A(ValueClass(x, x+1)), mem(x*x) {}
-// CHECK-LABEL: define void @_ZN1DC1Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
-// CHECK: call void @_ZN10ValueClassC1Eii(
-// CHECK: call void @_ZN1AC2E10ValueClass(
-// CHECK: call void @_ZN6MemberC1Ei(
-
// CHECK-LABEL: define void @_ZN1DC2Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
+// CHECK-LABEL: define void @_ZN1DC1Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
+// CHECK: call void @_ZN10ValueClassC1Eii(
+// CHECK: call void @_ZN1AC2E10ValueClass(
+// CHECK: call void @_ZN6MemberC1Ei(
// PR6622: this shouldn't crash
namespace test0 {
diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp
index e497acf..c3be962 100644
--- a/test/CodeGenCXX/convert-to-fptr.cpp
+++ b/test/CodeGenCXX/convert-to-fptr.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -39,9 +38,5 @@
return 0;
}
-// CHECK-LP64: callq __ZN1AcvPFiiEEv
-// CHECK-LP64: callq __ZN1BcvRFiiEEv
-
-// CHECK-LP32: calll L__ZN1AcvPFiiEEv
-// CHECK-LP32: calll L__ZN1BcvRFiiEEv
-
+// CHECK: call i32 (i32)* (%struct.A*)* @_ZN1AcvPFiiEEv
+// CHECK: call i32 (i32)* (%struct.B*)* @_ZN1BcvRFiiEEv
diff --git a/test/CodeGenCXX/copy-assign-synthesis-1.cpp b/test/CodeGenCXX/copy-assign-synthesis-1.cpp
index 2ffc7bc..ae21141 100644
--- a/test/CodeGenCXX/copy-assign-synthesis-1.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis-1.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
+// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
// RUN: FileCheck %s
// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
diff --git a/test/CodeGenCXX/copy-assign-synthesis-2.cpp b/test/CodeGenCXX/copy-assign-synthesis-2.cpp
index 18e92f9..0bc7d3d 100644
--- a/test/CodeGenCXX/copy-assign-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis-2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
struct A {};
A& (A::*x)(const A&) = &A::operator=;
-// CHECK-LABEL: define linkonce_odr %struct.A* @_ZN1AaSERKS_
+// CHECK-LABEL: define linkonce_odr {{.*}}%struct.A* @_ZN1AaSERKS_
diff --git a/test/CodeGenCXX/copy-constructor-elim.cpp b/test/CodeGenCXX/copy-constructor-elim.cpp
index ad3a87b..8e9bee9 100644
--- a/test/CodeGenCXX/copy-constructor-elim.cpp
+++ b/test/CodeGenCXX/copy-constructor-elim.cpp
@@ -1,6 +1,9 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
-// RUN: not grep "_ZN1CC1ERK1C" %t
-// RUN: not grep "_ZN1SC1ERK1S" %t
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK
+// RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix MS
+// CHECK-NOT: _ZN1CC1ERK1C
+// CHECK-NOT: _ZN1SC1ERK1S
+// MS-NOT: ?0C@@QAE@ABV0
+// MS-NOT: ?0S@@QAE@ABV0
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
index 03c6633..47c34ca 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
struct A { virtual void a(); };
A x(A& y) { return y; }
diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp
index c8b265c..ab36153 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp
@@ -139,12 +139,10 @@
// CHECK: define linkonce_odr [[A:%.*]]* @_ZN12rdar138169401AaSERKS0_(
// CHECK: [[THIS:%.*]] = load [[A]]**
// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[A]]* [[THIS]], i32 0, i32 1
-// CHECK-NEXT: [[T1:%.*]] = bitcast [2 x i8]* [[T0]] to i16*
// CHECK-NEXT: [[OTHER:%.*]] = load [[A]]**
// CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[A]]* [[OTHER]], i32 0, i32 1
-// CHECK-NEXT: [[T3:%.*]] = bitcast [2 x i8]* [[T2]] to i16*
-// CHECK-NEXT: [[T4:%.*]] = bitcast i16* [[T1]] to i8*
-// CHECK-NEXT: [[T5:%.*]] = bitcast i16* [[T3]] to i8*
+// CHECK-NEXT: [[T4:%.*]] = bitcast i16* [[T0]] to i8*
+// CHECK-NEXT: [[T5:%.*]] = bitcast i16* [[T2]] to i8*
// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T4]], i8* [[T5]], i64 8, i32 8, i1 false)
// CHECK-NEXT: ret [[A]]* [[THIS]]
@@ -153,12 +151,10 @@
// CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[THIS]] to i8***
// CHECK-NEXT: store i8** getelementptr inbounds ([4 x i8*]* @_ZTVN12rdar138169401AE, i64 0, i64 2), i8*** [[T0]]
// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[A]]* [[THIS]], i32 0, i32 1
-// CHECK-NEXT: [[T1:%.*]] = bitcast [2 x i8]* [[T0]] to i16*
// CHECK-NEXT: [[OTHER:%.*]] = load [[A]]**
// CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[A]]* [[OTHER]], i32 0, i32 1
-// CHECK-NEXT: [[T3:%.*]] = bitcast [2 x i8]* [[T2]] to i16*
-// CHECK-NEXT: [[T4:%.*]] = bitcast i16* [[T1]] to i8*
-// CHECK-NEXT: [[T5:%.*]] = bitcast i16* [[T3]] to i8*
+// CHECK-NEXT: [[T4:%.*]] = bitcast i16* [[T0]] to i8*
+// CHECK-NEXT: [[T5:%.*]] = bitcast i16* [[T2]] to i8*
// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T4]], i8* [[T5]], i64 8, i32 8, i1 false)
// CHECK-NEXT: ret void
diff --git a/test/CodeGenCXX/coverage.cpp b/test/CodeGenCXX/coverage.cpp
index 1f1611b..88f7409 100644
--- a/test/CodeGenCXX/coverage.cpp
+++ b/test/CodeGenCXX/coverage.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -test-coverage -femit-coverage-notes | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - -test-coverage -femit-coverage-notes | FileCheck %s
extern "C" void test_name1() {}
void test_name2() {}
diff --git a/test/CodeGenCXX/ctor-dtor-alias.cpp b/test/CodeGenCXX/ctor-dtor-alias.cpp
index 235d165..d869a2b 100644
--- a/test/CodeGenCXX/ctor-dtor-alias.cpp
+++ b/test/CodeGenCXX/ctor-dtor-alias.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
-// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
-// RUN: %clang_cc1 -cc1 -triple x86_64--netbsd -emit-llvm \
+// RUN: %clang_cc1 -triple x86_64--netbsd -emit-llvm \
// RUN: -mconstructor-aliases -O2 %s -o - | FileCheck --check-prefix=CHECK-RAUW %s
namespace test1 {
@@ -61,7 +61,7 @@
// test that we don't do this optimization at -O0 so that the debugger can
// see both destructors.
// NOOPT-DAG: call i32 @__cxa_atexit{{.*}}@_ZN5test41BD2Ev
- // NOOOPT-DAG: define linkonce_odr void @_ZN5test41BD2Ev
+ // NOOPT-DAG: define linkonce_odr void @_ZN5test41BD2Ev
struct A {
virtual ~A() {}
};
@@ -133,6 +133,22 @@
zed foo;
}
+namespace test9 {
+struct foo {
+ __attribute__((stdcall)) ~foo() {
+ }
+};
+
+struct bar : public foo {};
+
+void zed() {
+ // Test that we produce a call to bar's destructor. We used to call foo's, but
+ // it has a different calling conversion.
+ // CHECK-DAG: call void @_ZN5test93barD2Ev
+ bar ptr;
+}
+}
+
// CHECK-RAUW: @_ZTV1C = linkonce_odr unnamed_addr constant [4 x i8*] [{{[^@]*}}@_ZTI1C {{[^@]*}}@_ZN1CD2Ev {{[^@]*}}@_ZN1CD0Ev {{[^@]*}}]
// r194296 replaced C::~C with B::~B without emitting the later.
diff --git a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp
index f4d5ccc..6f4c533 100644
--- a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp
+++ b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp
@@ -1,16 +1,16 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
template <typename T>
struct X {
X();
};
-// CHECK: define {{.*}} @_ZN1XIbEC1Ev
// CHECK: define {{.*}} @_ZN1XIbEC2Ev
+// CHECK: define {{.*}} @_ZN1XIbEC1Ev
template <> X<bool>::X() = default;
-// CHECK: define weak_odr {{.*}} @_ZN1XIiEC1Ev
// CHECK: define weak_odr {{.*}} @_ZN1XIiEC2Ev
+// CHECK: define weak_odr {{.*}} @_ZN1XIiEC1Ev
template <typename T> X<T>::X() = default;
template X<int>::X();
diff --git a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
index c48e61f..dcc0556 100644
--- a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
+++ b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
@@ -26,28 +26,30 @@
delegator::delegator(bool)
{}
-// CHECK: define {{.*}} @_ZN9delegatorC1Ec
-// CHECK: {{.*}} @_ZN9delegatorC1Eb
-// CHECK: void @__cxa_throw
-// CHECK: void @__clang_call_terminate
-// CHECK: {{.*}} @_ZN9delegatorD1Ev
-// CHECK: define {{.*}} @_ZN9delegatorC2Ec
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ec
// CHECK: {{.*}} @_ZN9delegatorC2Eb
// CHECK: void @__cxa_throw
// CHECK: void @__clang_call_terminate
// CHECK: {{.*}} @_ZN9delegatorD2Ev
+
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ec
+// CHECK: {{.*}} @_ZN9delegatorC1Eb
+// CHECK: void @__cxa_throw
+// CHECK: void @__clang_call_terminate
+// CHECK: {{.*}} @_ZN9delegatorD1Ev
delegator::delegator(char)
: delegator(true) {
throw 0;
}
-// CHECK: define {{.*}} @_ZN9delegatorC1Ei
-// CHECK: {{.*}} @_ZN9delegatorC1Ev
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ei
+// CHECK: {{.*}} @_ZN9delegatorC2Ev
// CHECK-NOT: void @_ZSt9terminatev
// CHECK: ret
// CHECK-NOT: void @_ZSt9terminatev
-// CHECK: define {{.*}} @_ZN9delegatorC2Ei
-// CHECK: {{.*}} @_ZN9delegatorC2Ev
+
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ei
+// CHECK: {{.*}} @_ZN9delegatorC1Ev
// CHECK-NOT: void @_ZSt9terminatev
// CHECK: ret
// CHECK-NOT: void @_ZSt9terminatev
diff --git a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
index 091d7b7..d36fe1c 100644
--- a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
+++ b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
@@ -73,7 +73,7 @@
// CHECK-DYNAMIC-BL: store i32 1, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0)
// CHECK-DYNAMIC-BL: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 1)
// CHECK-DYNAMIC-BL: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0),
-// CHECK-DYMAMIC-BL: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 0), align 8
+// CHECK-DYNAMIC-BL: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 0), align 8
// CHECK-DYNAMIC-BL: store i64 2, i64* getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 1), align 8
// CHECK-DYNAMIC-BL: store i32 3, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i64 0, i64 0)
// CHECK-DYNAMIC-BL: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i64 0, i64 1)
@@ -111,9 +111,9 @@
// CHECK-DYNAMIC-BE: store i32 1, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0)
// CHECK-DYNAMIC-BE: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 1)
// CHECK-DYNAMIC-BE: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0),
-// CHECK-DYMAMIC-BE: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 0), align 8
+// CHECK-DYNAMIC-BE: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 0), align 8
// CHECK-DYNAMIC-BE: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 1, i64 0),
-// CHECK-DYMAMIC-BE: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 1), align 8
+// CHECK-DYNAMIC-BE: i32** getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested, i64 0, i64 0, i32 1), align 8
// CHECK-DYNAMIC-BE: store i32 3, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i64 0, i64 0)
// CHECK-DYNAMIC-BE: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i64 0, i64 1)
// CHECK-DYNAMIC-BE: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i64 0, i64 0),
diff --git a/test/CodeGenCXX/cxx11-exception-spec.cpp b/test/CodeGenCXX/cxx11-exception-spec.cpp
index 96ea1d7..3b1516b 100644
--- a/test/CodeGenCXX/cxx11-exception-spec.cpp
+++ b/test/CodeGenCXX/cxx11-exception-spec.cpp
@@ -1,4 +1,5 @@
-// RUN: not %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s
+// expected-no-diagnostics
void h();
diff --git a/test/CodeGenCXX/cxx11-initializer-array-new.cpp b/test/CodeGenCXX/cxx11-initializer-array-new.cpp
index 23577be..8de88dc 100644
--- a/test/CodeGenCXX/cxx11-initializer-array-new.cpp
+++ b/test/CodeGenCXX/cxx11-initializer-array-new.cpp
@@ -99,8 +99,9 @@
// CHECK: icmp eq %[[S]]* %[[NEXT_INNER]], %[[END_INNER]]
// CHECK: br i1
//
-// CHECK: %[[NEXT_OUTER:.*]] = getelementptr %[[S]]* %{{.*}}, i32 1
-// CHECK: icmp eq %[[S]]* %[[NEXT_OUTER]], %[[END_AS_S]]
+// CHECK: %[[NEXT_OUTER:.*]] = getelementptr [3 x %[[S]]]* %{{.*}}, i32 1
+// CHECK: %[[NEXT_OUTER_AS_S:.*]] = bitcast [3 x %[[S]]]* %[[NEXT_OUTER]] to %[[S]]*
+// CHECK: icmp eq %[[S]]* %[[NEXT_OUTER_AS_S]], %[[END_AS_S]]
// CHECK: br i1
//
// CHECK: }
diff --git a/test/CodeGenCXX/cxx11-noreturn.cpp b/test/CodeGenCXX/cxx11-noreturn.cpp
index 31c651d..b876bb9 100644
--- a/test/CodeGenCXX/cxx11-noreturn.cpp
+++ b/test/CodeGenCXX/cxx11-noreturn.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -std=c++11 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 %s -o - | FileCheck %s
int g();
diff --git a/test/CodeGenCXX/cxx11-thread-local.cpp b/test/CodeGenCXX/cxx11-thread-local.cpp
index 509562d..86734cd 100644
--- a/test/CodeGenCXX/cxx11-thread-local.cpp
+++ b/test/CodeGenCXX/cxx11-thread-local.cpp
@@ -135,6 +135,16 @@
return l();
}
+struct PR19254 {
+ static thread_local int n;
+ int f();
+};
+// CHECK: define {{.*}} @_ZN7PR192541fEv(
+int PR19254::f() {
+ // CHECK: call void @_ZTHN7PR192541nE(
+ return this->n;
+}
+
// CHECK: define {{.*}} @[[V_M_INIT:.*]]()
// CHECK: load i8* bitcast (i64* @_ZGVN1VIiE1mE to i8*)
// CHECK: %[[V_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0
diff --git a/test/CodeGenCXX/cxx11-unrestricted-union.cpp b/test/CodeGenCXX/cxx11-unrestricted-union.cpp
index 0397775..2f22ad2 100644
--- a/test/CodeGenCXX/cxx11-unrestricted-union.cpp
+++ b/test/CodeGenCXX/cxx11-unrestricted-union.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -emit-llvm %s -o - | FileCheck %s
struct A {
A(); A(const A&); A(A&&); A &operator=(const A&); A &operator=(A&&); ~A();
diff --git a/test/CodeGenCXX/debug-info-byval.cpp b/test/CodeGenCXX/debug-info-byval.cpp
index e6317fc..5b0850b 100644
--- a/test/CodeGenCXX/debug-info-byval.cpp
+++ b/test/CodeGenCXX/debug-info-byval.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang -g -S %s -o - | FileCheck %s
+// FIXME: Check IR rather than asm, then triple is not needed.
+// RUN: %clang -Xclang -triple=%itanium_abi_triple -g -S %s -o - | FileCheck %s
// Test to check presence of debug info for byval parameter.
// Radar 8350436.
class DAG {
diff --git a/test/CodeGenCXX/debug-info-char16.cpp b/test/CodeGenCXX/debug-info-char16.cpp
index 06a05b3..e6e2f15 100644
--- a/test/CodeGenCXX/debug-info-char16.cpp
+++ b/test/CodeGenCXX/debug-info-char16.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -std=c++11 -g %s -o -| FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -g %s -o -| FileCheck %s
// 16 is DW_ATE_UTF (0x10) encoding attribute.
char16_t char_a = u'h';
diff --git a/test/CodeGenCXX/debug-info-class-limited.cpp b/test/CodeGenCXX/debug-info-class-limited.cpp
index a4b9f46..30abd2d 100644
--- a/test/CodeGenCXX/debug-info-class-limited.cpp
+++ b/test/CodeGenCXX/debug-info-class-limited.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
+// RUN: %clang -emit-llvm -fno-standalone-debug -g -S %s -o - | FileCheck %s
namespace PR16214_1 {
// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
@@ -24,7 +24,7 @@
}
namespace test1 {
-// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [decl]
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
struct foo {
};
diff --git a/test/CodeGenCXX/debug-info-class-nolimit.cpp b/test/CodeGenCXX/debug-info-class-nolimit.cpp
index ce72bd3..7a6ee4d 100644
--- a/test/CodeGenCXX/debug-info-class-nolimit.cpp
+++ b/test/CodeGenCXX/debug-info-class-nolimit.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unk-unk -fstandalone-debug -o - -emit-llvm -g %s | FileCheck %s
+// On Darwin, this should be the default:
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -o - -emit-llvm -g %s | FileCheck %s
namespace rdar14101097_1 { // see also PR16214
// Check that we emit debug info for the definition of a struct if the
diff --git a/test/CodeGenCXX/debug-info-class.cpp b/test/CodeGenCXX/debug-info-class.cpp
index e1402c9..7c22be1 100644
--- a/test/CodeGenCXX/debug-info-class.cpp
+++ b/test/CodeGenCXX/debug-info-class.cpp
@@ -102,13 +102,9 @@
// CHECK: [[C_S]] = {{.*}} ; [ DW_TAG_member ] [s] {{.*}} [static] [from int]
// CHECK: [[C_DTOR]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [~C]
-// CHECK: metadata [[D_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTS1D"} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
-// CHECK: [[D_MEM]] = metadata !{metadata [[D_FUNC:![0-9]*]]}
-// CHECK: [[D_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
+// CHECK: null, i32 0, null, null, metadata !"_ZTS1D"} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
// CHECK: null, i32 0, null, null, metadata !"_ZTS1E"} ; [ DW_TAG_structure_type ] [E] {{.*}} [decl]
-// CHECK: [[F:![0-9]*]] = {{.*}} metadata [[F_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTS1F"} ; [ DW_TAG_structure_type ] [F] {{.*}} [decl]
-// CHECK: [[F_MEM]] = metadata !{metadata [[F_I:![0-9]*]]}
-// CHECK: [[F_I]] = {{.*}} ; [ DW_TAG_member ] [i]
+// CHECK: [[F:![0-9]*]] = {{.*}} null, i32 0, null, null, metadata !"_ZTS1F"} ; [ DW_TAG_structure_type ] [F] {{.*}} [decl]
// CHECK: null, i32 0, null, null, metadata !"_ZTS1G"} ; [ DW_TAG_structure_type ] [G] {{.*}} [decl]
// CHECK: metadata [[G_INNER_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTSN1G5innerE"} ; [ DW_TAG_structure_type ] [inner] [line 50, {{.*}} [def]
@@ -118,8 +114,13 @@
// CHECK: ; [ DW_TAG_structure_type ] [A]
// CHECK: HdrSize
// CHECK: ; [ DW_TAG_structure_type ] [I] {{.*}} [def]
+//
+// CHECK: metadata !"_ZTS1D", {{.*}}, metadata [[D_FUNC_DECL:![0-9]*]], metadata {{![0-9]*}}, i32 {{[0-9]*}}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
+// CHECK: [[D_FUNC_DECL]] = {{.*}}, metadata !"_ZTS1D", {{.*}}, i32 0, metadata {{![0-9]*}}, i32 {{[0-9]*}}} ; [ DW_TAG_subprogram ] {{.*}} [func]
-// CHECK: [[F_I_DEF:![0-9]*]] = {{.*}}, metadata [[F_I]]} ; [ DW_TAG_variable ] [i]
+// CHECK: [[F_I_DEF:![0-9]*]] = {{.*}}, metadata [[F_I:![0-9]*]]} ; [ DW_TAG_variable ] [i]
+
+// CHECK: [[F_I]] = {{.*}}, metadata !"_ZTS1F", {{.*}} ; [ DW_TAG_member ] [i]
// CHECK: ![[EXCEPTLOC]] = metadata !{i32 84,
// CHECK: ![[RETLOC]] = metadata !{i32 83,
diff --git a/test/CodeGenCXX/debug-info-ctor2.cpp b/test/CodeGenCXX/debug-info-ctor2.cpp
index 19bd64b..3bc931e 100644
--- a/test/CodeGenCXX/debug-info-ctor2.cpp
+++ b/test/CodeGenCXX/debug-info-ctor2.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang -fverbose-asm -g -S %s -o - | grep AT_explicit
+// FIXME: Check IR rather than asm, then triple is not needed.
+// RUN: %clang -Xclang -triple=%itanium_abi_triple -fverbose-asm -g -S %s -o - | grep AT_explicit
class MyClass
diff --git a/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp b/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
index 04fe7a0..1b9a055 100644
--- a/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ b/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -fno-limit-debug-info %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -fstandalone-debug %s -o - | FileCheck %s
class Test
{
diff --git a/test/CodeGenCXX/debug-info-enum.cpp b/test/CodeGenCXX/debug-info-enum.cpp
index f0e2608..7e02ede 100644
--- a/test/CodeGenCXX/debug-info-enum.cpp
+++ b/test/CodeGenCXX/debug-info-enum.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s
// CHECK: [[ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_compile_unit ]
// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]], metadata [[E3:![0-9]*]]}
diff --git a/test/CodeGenCXX/debug-info-gline-tables-only.cpp b/test/CodeGenCXX/debug-info-gline-tables-only.cpp
index 7ecdeb2..b766c73 100644
--- a/test/CodeGenCXX/debug-info-gline-tables-only.cpp
+++ b/test/CodeGenCXX/debug-info-gline-tables-only.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -gline-tables-only -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fno-rtti -gline-tables-only -S -emit-llvm -o - | FileCheck %s
// Checks that clang with "-gline-tables-only" doesn't emit debug info
// for variables and types.
diff --git a/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp b/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
index afa7707..28b1fab 100644
--- a/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
+++ b/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 %s -g -fno-use-cxa-atexit -S -emit-llvm -o - \
+// RUN: %clang_cc1 %s -g -triple %itanium_abi_triple -fno-use-cxa-atexit -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-NOKEXT
-// RUN: %clang_cc1 %s -g -fno-use-cxa-atexit -fapple-kext -S -emit-llvm -o - \
+// RUN: %clang_cc1 %s -g -triple %itanium_abi_triple -fno-use-cxa-atexit -fapple-kext -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-KEXT
class A {
diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
new file mode 100644
index 0000000..131ceba
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+//
+// Test that indirect field decls are handled gracefully.
+// rdar://problem/16348575
+//
+template <class T, int T::*ptr> class Foo { };
+
+struct Bar {
+ int i1;
+ // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E]
+ union {
+ // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int]
+ int i2;
+ };
+};
+
+Foo<Bar, &Bar::i2> the_foo;
diff --git a/test/CodeGenCXX/debug-info-limited.cpp b/test/CodeGenCXX/debug-info-limited.cpp
index 54a2424..294d1f6 100644
--- a/test/CodeGenCXX/debug-info-limited.cpp
+++ b/test/CodeGenCXX/debug-info-limited.cpp
@@ -11,8 +11,7 @@
return a;
}
-// Verify that we're not emitting a full definition of B in limit debug mode.
-// CHECK: ; [ DW_TAG_class_type ] [B] {{.*}} [decl]
+// CHECK: ; [ DW_TAG_class_type ] [B] {{.*}} [def]
class B {
public:
diff --git a/test/CodeGenCXX/debug-info-member.cpp b/test/CodeGenCXX/debug-info-member.cpp
index 8c2e3eb..7ba97b5 100644
--- a/test/CodeGenCXX/debug-info-member.cpp
+++ b/test/CodeGenCXX/debug-info-member.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang -fverbose-asm -g -S %s -o - | grep DW_ACCESS_public
+// FIXME: Check IR rather than asm, then triple is not needed.
+// RUN: %clang -Xclang -triple=%itanium_abi_triple -fverbose-asm -g -S %s -o - | grep DW_ACCESS_public
class A {
public:
int x;
diff --git a/test/CodeGenCXX/debug-info-method-spec.cpp b/test/CodeGenCXX/debug-info-method-spec.cpp
index 2068c5c..c00da00 100644
--- a/test/CodeGenCXX/debug-info-method-spec.cpp
+++ b/test/CodeGenCXX/debug-info-method-spec.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang -fverbose-asm -g -S %s -o - | grep DW_AT_specification
+// FIXME: Check IR rather than asm, then triple is not needed.
+// RUN: %clang -Xclang -triple=%itanium_abi_triple -fverbose-asm -g -S %s -o - | grep DW_AT_specification
// Radar 9254491
class A {
public:
diff --git a/test/CodeGenCXX/debug-info-method.cpp b/test/CodeGenCXX/debug-info-method.cpp
index 50b3f66..49b8dc4 100644
--- a/test/CodeGenCXX/debug-info-method.cpp
+++ b/test/CodeGenCXX/debug-info-method.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -std=c++11 -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -g %s -o - | FileCheck %s
// CHECK: metadata !"_ZTS1A"} ; [ DW_TAG_class_type ] [A]
// CHECK: metadata !"_ZN1A3fooEiS_3$_0", {{.*}} [protected]
// CHECK: ![[THISTYPE:[0-9]+]] = {{.*}} ; [ DW_TAG_pointer_type ] {{.*}} [artificial] [from _ZTS1A]
diff --git a/test/CodeGenCXX/debug-info-method2.cpp b/test/CodeGenCXX/debug-info-method2.cpp
index a927c49..a365312 100644
--- a/test/CodeGenCXX/debug-info-method2.cpp
+++ b/test/CodeGenCXX/debug-info-method2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -flimit-debug-info -x c++ -g -S -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -fno-standalone-debug -x c++ -g -S -emit-llvm < %s | FileCheck %s
// rdar://10336845
// Preserve type qualifiers in -flimit-debug-info mode.
diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp
index a2d7ede..473034c 100644
--- a/test/CodeGenCXX/debug-info-namespace.cpp
+++ b/test/CodeGenCXX/debug-info-namespace.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang -g -gline-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
-// RUN: %clang -g -fno-limit-debug-info -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
+// RUN: %clang -g -fno-standalone-debug -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang -g -gline-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
+// RUN: %clang -g -fstandalone-debug -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
namespace A {
#line 1 "foo.cpp"
@@ -36,10 +36,14 @@
return i + X::B::i + Y::B::i;
}
+namespace A {
+using B::i;
+}
+
// This should work even if 'i' and 'func' were declarations & not definitions,
// but it doesn't yet.
-// CHECK: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !""} ; [ DW_TAG_compile_unit ]
+// CHECK: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !"", i32 1} ; [ DW_TAG_compile_unit ]
// CHECK: [[FILE:![0-9]*]] {{.*}}debug-info-namespace.cpp"
// CHECK: [[FOO:![0-9]*]] {{.*}} ; [ DW_TAG_structure_type ] [foo] [line 5, size 0, align 0, offset 0] [decl] [from ]
// CHECK: [[FOOCPP:![0-9]*]] = metadata !{metadata !"foo.cpp", {{.*}}
@@ -50,7 +54,7 @@
// CHECK: [[FUNC:![0-9]*]] {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
// CHECK: [[FILE2]]} ; [ DW_TAG_file_type ] [{{.*}}foo.cpp]
// CHECK: [[I:![0-9]*]] = {{.*}}, metadata [[NS]], metadata !"i", {{.*}} ; [ DW_TAG_variable ] [i]
-// CHECK: [[MODULES]] = metadata !{metadata [[M1:![0-9]*]], metadata [[M2:![0-9]*]], metadata [[M3:![0-9]*]], metadata [[M4:![0-9]*]], metadata [[M5:![0-9]*]], metadata [[M6:![0-9]*]], metadata [[M7:![0-9]*]], metadata [[M8:![0-9]*]], metadata [[M9:![0-9]*]], metadata [[M10:![0-9]*]], metadata [[M11:![0-9]*]], metadata [[M12:![0-9]*]]}
+// CHECK: [[MODULES]] = metadata !{metadata [[M1:![0-9]*]], metadata [[M2:![0-9]*]], metadata [[M3:![0-9]*]], metadata [[M4:![0-9]*]], metadata [[M5:![0-9]*]], metadata [[M6:![0-9]*]], metadata [[M7:![0-9]*]], metadata [[M8:![0-9]*]], metadata [[M9:![0-9]*]], metadata [[M10:![0-9]*]], metadata [[M11:![0-9]*]], metadata [[M12:![0-9]*]], metadata [[M13:![0-9]*]]}
// CHECK: [[M1]] = metadata !{i32 {{[0-9]*}}, metadata [[CTXT]], metadata [[NS]], i32 11} ; [ DW_TAG_imported_module ]
// CHECK: [[M2]] = metadata !{i32 {{[0-9]*}}, metadata [[CU]], metadata [[CTXT]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_module ]
// CHECK: [[M3]] = metadata !{i32 {{[0-9]*}}, metadata [[CU]], metadata [[CTXT]], i32 15, metadata !"E"} ; [ DW_TAG_imported_module ]
@@ -58,20 +62,22 @@
// CHECK: [[LEX2]] = metadata !{i32 {{[0-9]*}}, metadata [[FILE2]], metadata [[LEX1:![0-9]+]], i32 {{[0-9]*}}, i32 0, i32 {{.*}}} ; [ DW_TAG_lexical_block ]
// CHECK: [[LEX1]] = metadata !{i32 {{[0-9]*}}, metadata [[FILE2]], metadata [[FUNC]], i32 {{[0-9]*}}, i32 0, i32 {{.*}}} ; [ DW_TAG_lexical_block ]
// CHECK: [[M5]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[CTXT]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_module ]
-// CHECK: [[M6]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[FOO:![0-9]*]], i32 23} ; [ DW_TAG_imported_declaration ]
-// CHECK: [[M7]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAR:![0-9]*]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
+// CHECK: [[M6]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[FOO:!"_ZTSN1A1B3fooE"]], i32 23} ; [ DW_TAG_imported_declaration ]
+// CHECK: [[M7]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAR:!"_ZTSN1A1B3barE"]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
// CHECK: [[M8]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[F1]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
// CHECK: [[M9]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[I]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
// CHECK: [[M10]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAZ:![0-9]*]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
// CHECK: [[BAZ]] = metadata !{i32 {{[0-9]*}}, metadata [[FOOCPP]], metadata [[NS]], {{.*}}, metadata !"_ZTSN1A1B3barE"} ; [ DW_TAG_typedef ] [baz] {{.*}} [from _ZTSN1A1B3barE]
// CHECK: [[M11]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[CTXT]], i32 {{[0-9]*}}, metadata !"X"} ; [ DW_TAG_imported_module ]
// CHECK: [[M12]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[M11]], i32 {{[0-9]*}}, metadata !"Y"} ; [ DW_TAG_imported_module ]
+// CHECK: [[M13]] = metadata !{i32 {{[0-9]*}}, metadata [[CTXT]], metadata [[I]], i32 {{[0-9]*}}} ; [ DW_TAG_imported_declaration ]
-// CHECK-GMLT: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !""} ; [ DW_TAG_compile_unit ]
-// CHECK-GMLT: [[MODULES]] = metadata !{i32 0}
+// CHECK-GMLT: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !"", i32 2} ; [ DW_TAG_compile_unit ]
+// CHECK-GMLT: [[MODULES]] = metadata !{}
// CHECK-NOLIMIT: ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [def] [from ]
// FIXME: It is confused on win32 to generate file entry when dosish filename is given.
// REQUIRES: shell
// REQUIRES: shell-preserves-root
+// REQUIRES: dw2
diff --git a/test/CodeGenCXX/debug-info-pubtypes.cpp b/test/CodeGenCXX/debug-info-pubtypes.cpp
deleted file mode 100644
index 6393cdd..0000000
--- a/test/CodeGenCXX/debug-info-pubtypes.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// REQUIRES: x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fno-limit-debug-info -S -mllvm -generate-dwarf-pub-sections=Enable %s -o - | FileCheck %s
-
-// FIXME: This testcase shouldn't rely on assembly emission.
-//CHECK: Lpubtypes_begin[[SECNUM:[0-9]:]]
-//CHECK: .asciz "G"
-//CHECK-NEXT: .long 0
-//CHECK-NEXT: Lpubtypes_end[[SECNUM]]
-
-class G {
-public:
- void foo();
-};
-
-void G::foo() {
-}
diff --git a/test/CodeGenCXX/debug-info-qualifiers.cpp b/test/CodeGenCXX/debug-info-qualifiers.cpp
new file mode 100644
index 0000000..c6b935f
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-qualifiers.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// Test (r)value and CVR qualifiers on C++11 non-static member functions.
+class A {
+public:
+ // CHECK: i32 [[@LINE+2]], metadata ![[PLSR:[0-9]+]], {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+2]]] [reference] [l]
+ // CHECK: ![[PLSR]] ={{.*}}[ DW_TAG_subroutine_type ]{{.*}}[reference]
+ void l() const &;
+ // CHECK: ![[ARGS:[0-9]+]] = metadata !{null, metadata ![[THIS:[0-9]+]]}
+ // CHECK: ![[THIS]] = {{.*}} metadata ![[CONST_A:.*]]} ; [ DW_TAG_pointer_type ]
+ // CHECK: ![[CONST_A]] = {{.*}} [ DW_TAG_const_type ]
+ // CHECK: i32 [[@LINE+2]], metadata ![[PRSR:[0-9]+]], {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+2]]] [rvalue reference] [r]
+ // CHECK: ![[PRSR]] ={{.*}}metadata ![[ARGS]], i32 0, null, null, null}{{.*}}[ DW_TAG_subroutine_type ]{{.*}}[rvalue reference]
+ void r() const &&;
+};
+
+void g() {
+ A a;
+ // The type of pl is "void (A::*)() const &".
+ // CHECK: metadata ![[PL:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pl] [line [[@LINE+2]]]
+ // CHECK: metadata ![[PLSR]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ]
+ auto pl = &A::l;
+
+ // CHECK: metadata ![[PR:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pr] [line [[@LINE+2]]]
+ // CHECK: metadata ![[PRSR]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ]
+ auto pr = &A::r;
+}
diff --git a/test/CodeGenCXX/debug-info-same-line.cpp b/test/CodeGenCXX/debug-info-same-line.cpp
index 519e9ee..05b426e 100644
--- a/test/CodeGenCXX/debug-info-same-line.cpp
+++ b/test/CodeGenCXX/debug-info-same-line.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -g -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
// Make sure that clang outputs distinct debug info for a function
// that is inlined twice on the same line. Otherwise it would appear
diff --git a/test/CodeGenCXX/debug-info-scope.cpp b/test/CodeGenCXX/debug-info-scope.cpp
index 557ee31..0447dc0 100644
--- a/test/CodeGenCXX/debug-info-scope.cpp
+++ b/test/CodeGenCXX/debug-info-scope.cpp
@@ -17,12 +17,12 @@
int main2() {
// CHECK: [ DW_TAG_auto_variable ] [ptr] [line [[@LINE+2]]]
-// CHECK metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ]
+// CHECK: metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ]
if (char *ptr = return_char(1)) {
printf ("%s", ptr);
}
// CHECK: [ DW_TAG_auto_variable ] [ptr] [line [[@LINE+2]]]
-// CHECK metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ]
+// CHECK: metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ]
if (char *ptr = return_char(2)) {
printf ("%s", ptr);
}
diff --git a/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
new file mode 100644
index 0000000..506c0d5
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - -fno-standalone-debug | FileCheck %s
+
+// Run again with -gline-tables-only and verify we don't crash. We won't output
+// type info at all.
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - -gline-tables-only | FileCheck %s -check-prefix LINES-ONLY
+
+// LINES-ONLY-NOT: DW_TAG_structure_type
+
+template <typename T>
+struct a {
+};
+extern template class a<int>;
+// CHECK-NOT: ; [ DW_TAG_structure_type ] [a<int>]
+
+template <typename T>
+struct b {
+};
+extern template class b<int>;
+b<int> bi;
+// CHECK: ; [ DW_TAG_structure_type ] [b<int>] {{.*}} [def]
+
+template <typename T>
+struct c {
+ void f() {}
+};
+extern template class c<int>;
+c<int> ci;
+// CHECK: ; [ DW_TAG_structure_type ] [c<int>] {{.*}} [decl]
+
+template <typename T>
+struct d {
+ void f();
+};
+extern template class d<int>;
+d<int> di;
+// CHECK: ; [ DW_TAG_structure_type ] [d<int>] {{.*}} [def]
+
+template <typename T>
+struct e {
+ void f();
+};
+template <typename T>
+void e<T>::f() {
+}
+extern template class e<int>;
+e<int> ei;
+// There's no guarantee that the out of line definition will appear before the
+// explicit template instantiation definition, so conservatively emit the type
+// definition here.
+// CHECK: ; [ DW_TAG_structure_type ] [e<int>] {{.*}} [def]
+
+template <typename T>
+struct f {
+ void g();
+};
+extern template class f<int>;
+template <typename T>
+void f<T>::g() {
+}
+f<int> fi;
+// CHECK: ; [ DW_TAG_structure_type ] [f<int>] {{.*}} [def]
+
+template <typename T>
+struct g {
+ void f();
+};
+template <>
+void g<int>::f();
+extern template class g<int>;
+g<int> gi;
+// CHECK: ; [ DW_TAG_structure_type ] [g<int>] {{.*}} [def]
+
+template <typename T>
+struct h {
+};
+template class h<int>;
+// CHECK: ; [ DW_TAG_structure_type ] [h<int>] {{.*}} [def]
+
+template <typename T>
+struct i {
+ void f() {}
+};
+template<> void i<int>::f();
+extern template class i<int>;
+i<int> ii;
+// CHECK: ; [ DW_TAG_structure_type ] [i<int>] {{.*}} [def]
+
+template <typename T1, typename T2 = T1>
+struct j {
+};
+extern template class j<int>;
+j<int> jj;
+// CHECK: ; [ DW_TAG_structure_type ] [j<int, int>]
diff --git a/test/CodeGenCXX/debug-info-template-fwd.cpp b/test/CodeGenCXX/debug-info-template-fwd.cpp
new file mode 100644
index 0000000..b2b7073
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-template-fwd.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s
+// This test is for a crash when emitting debug info for not-yet-completed
+// types.
+// Test that we don't actually emit a forward decl for the offending class:
+// CHECK: [ DW_TAG_structure_type ] [Derived<int>] {{.*}} [def]
+// rdar://problem/15931354
+template <class A> class Derived;
+
+template <class A> class Base {
+ static Derived<A> *create();
+};
+
+template <class A> struct Derived : Base<A> {
+};
+
+Base<int> *f;
+
+// During the instantiation of Derived<int>, Base<int> becomes required to be
+// complete - since the declaration has already been emitted (due to 'f',
+// above), we immediately try to build debug info for Base<int> which then
+// requires the (incomplete definition) of Derived<int> which is problematic.
+//
+// (if 'f' is not present, the point at which Base<int> becomes required to be
+// complete during the instantiation of Derived<int> is a no-op because
+// Base<int> was never emitted so we ignore it and carry on until we
+// wire up the base class of Derived<int> in the debug info later on)
+Derived<int> d;
diff --git a/test/CodeGenCXX/debug-info-template-limit.cpp b/test/CodeGenCXX/debug-info-template-limit.cpp
index c3e241e..e1f23ad 100644
--- a/test/CodeGenCXX/debug-info-template-limit.cpp
+++ b/test/CodeGenCXX/debug-info-template-limit.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fno-standalone-debug -triple %itanium_abi_triple -g %s -o - | FileCheck %s
// Check that this pointer type is TC<int>
// CHECK: ![[LINE:[0-9]+]] = {{.*}}"TC<int>", {{.*}} metadata !"_ZTS2TCIiE"} ; [ DW_TAG_class_type ]
diff --git a/test/CodeGenCXX/debug-info-template-member.cpp b/test/CodeGenCXX/debug-info-template-member.cpp
index 9ac1bef..c9a3d9b 100644
--- a/test/CodeGenCXX/debug-info-template-member.cpp
+++ b/test/CodeGenCXX/debug-info-template-member.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -g -fno-standalone-debug -triple x86_64-apple-darwin %s -o - | FileCheck %s
struct MyClass {
template <int i> int add(int j) {
@@ -21,7 +21,7 @@
// CHECK: [[FOO_FUNC]] = {{.*}}, metadata !"_ZN3foo4funcEN5outerIS_E5innerE", i32 {{[0-9]*}}, metadata [[FOO_FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
// CHECK: [[FOO_FUNC_TYPE]] = {{.*}}, metadata [[FOO_FUNC_PARAMS:![0-9]*]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ]
// CHECK: [[FOO_FUNC_PARAMS]] = metadata !{null, metadata !{{[0-9]*}}, metadata [[OUTER_FOO_INNER:![0-9]*]]}
-// CHECK: [[OUTER_FOO_INNER]] = {{.*}} ; [ DW_TAG_structure_type ] [inner]
+// CHECK: [[OUTER_FOO_INNER]] = {{.*}}, null, metadata !"[[OUTER_FOO_INNER_ID:.*]]"} ; [ DW_TAG_structure_type ] [inner]
// CHECK: metadata [[VIRT_MEM:![0-9]*]], i32 0, metadata !"_ZTS4virtI4elemE", metadata [[VIRT_TEMP_PARAM:![0-9]*]], metadata !"_ZTS4virtI4elemE"} ; [ DW_TAG_structure_type ] [virt<elem>] {{.*}} [def]
// CHECK: [[VIRT_TEMP_PARAM]] = metadata !{metadata [[VIRT_T:![0-9]*]]}
@@ -59,7 +59,7 @@
outer<foo>::inner x;
-// CHECK: metadata [[OUTER_FOO_INNER]], i32 {{[0-9]*}}, i32 {{[0-9]*}}, %"struct.outer<foo>::inner"* @x, {{.*}} ; [ DW_TAG_variable ] [x]
+// CHECK: metadata !"[[OUTER_FOO_INNER_ID]]", i32 {{[0-9]*}}, i32 {{[0-9]*}}, %"struct.outer<foo>::inner"* @x, {{.*}} ; [ DW_TAG_variable ] [x]
template <typename T>
struct virt {
diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp
index f58973b..d071830 100644
--- a/test/CodeGenCXX/debug-info-template.cpp
+++ b/test/CodeGenCXX/debug-info-template.cpp
@@ -1,7 +1,7 @@
// RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++11 | FileCheck %s
// CHECK: {{.*}}, i1 false, metadata !"", i32 0, metadata !{{[0-9]]*}}, metadata [[RETAIN:![0-9]*]], {{.*}} ; [ DW_TAG_compile_unit ]
-// CHECK: [[EMPTY:![0-9]*]] = metadata !{i32 0}
+// CHECK: [[EMPTY:![0-9]*]] = metadata !{}
// CHECK: [[RETAIN]] = metadata !{metadata !{{[0-9]]*}}, metadata [[FOO:![0-9]*]],
@@ -50,8 +50,8 @@
//
-// CHECK: [[TCNESTED:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata !"_ZTS2TCIjLj2EXadL_Z3glbEEXadL_ZN3foo1eEEEXadL_ZNS0_1fEvEEXadL_Z4funcvEE9tmpl_implJLi1ELi2ELi3EEE", {{.*}} ; [ DW_TAG_structure_type ] [nested]
-// CHECK: [[TCNT:![0-9]*]] = {{.*}}, metadata [[TCNARGS:![0-9]*]], metadata !"{{.*}}"} ; [ DW_TAG_structure_type ] [TC<int, -3, nullptr, nullptr, nullptr, nullptr, tmpl_impl>]
+// CHECK: metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata !"_ZTS2TCIjLj2EXadL_Z3glbEEXadL_ZN3foo1eEEEXadL_ZNS0_1fEvEEXadL_Z4funcvEE9tmpl_implJLi1ELi2ELi3EEE", {{.*}}, metadata !"[[TCNESTED:.*]]"} ; [ DW_TAG_structure_type ] [nested]
+// CHECK: metadata [[TCNARGS:![0-9]*]], metadata !"[[TCNT:.*]]"} ; [ DW_TAG_structure_type ] [TC<int, -3, nullptr, nullptr, nullptr, nullptr, tmpl_impl>]
// CHECK: [[TCNARGS]] = metadata !{metadata [[TCNARG1:![0-9]*]], metadata [[TCNARG2:![0-9]*]], metadata [[TCNARG3:![0-9]*]], metadata [[TCNARG4:![0-9]*]], metadata [[TCNARG5:![0-9]*]], metadata [[TCNARG6:![0-9]*]], metadata [[TCARG7:![0-9]*]], metadata [[TCNARG8:![0-9]*]]}
// CHECK: [[TCNARG1]] = {{.*}}metadata !"T", metadata [[INT]], {{.*}} ; [ DW_TAG_template_type_parameter ]
// CHECK: [[TCNARG2]] = {{.*}}metadata !"", metadata [[INT]], i32 -3, {{.*}} ; [ DW_TAG_template_value_parameter ]
@@ -77,9 +77,9 @@
// CHECK: [[PTOARG1]] = {{.*}}metadata !"", metadata [[CONST_PADDINGATEND_PTR:![0-9]*]], { i32, i8, [3 x i8] }* @PaddedObj, {{.*}} ; [ DW_TAG_template_value_parameter ]
// CHECK: [[CONST_PADDINGATEND_PTR]] = {{.*}} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS12PaddingAtEnd]
-// CHECK: metadata [[TCNESTED]], i32 0, i32 1, %"struct.TC<unsigned int, 2, &glb, &foo::e, &foo::f, &func, tmpl_impl, 1, 2, 3>::nested"* @tci, null} ; [ DW_TAG_variable ] [tci]
+// CHECK: metadata !"[[TCNESTED]]", i32 0, i32 1, %"struct.TC<unsigned int, 2, &glb, &foo::e, &foo::f, &func, tmpl_impl, 1, 2, 3>::nested"* @tci, null} ; [ DW_TAG_variable ] [tci]
-// CHECK: metadata [[TCNT:![0-9]*]], i32 0, i32 1, %struct.TC* @tcn, null} ; [ DW_TAG_variable ] [tcn]
+// CHECK: metadata !"[[TCNT]]", i32 0, i32 1, %struct.TC* @tcn, null} ; [ DW_TAG_variable ] [tcn]
struct foo {
char pad[8]; // make the member pointer to 'e' a bit more interesting (nonzero)
int e;
diff --git a/test/CodeGenCXX/debug-info-thunk.cpp b/test/CodeGenCXX/debug-info-thunk.cpp
index 2a50895..1d6f1a7 100644
--- a/test/CodeGenCXX/debug-info-thunk.cpp
+++ b/test/CodeGenCXX/debug-info-thunk.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -g -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -g -S -emit-llvm -o - | FileCheck %s
struct A {
virtual void f();
diff --git a/test/CodeGenCXX/debug-info-use-after-free.cpp b/test/CodeGenCXX/debug-info-use-after-free.cpp
index 852e148..0f28a90 100644
--- a/test/CodeGenCXX/debug-info-use-after-free.cpp
+++ b/test/CodeGenCXX/debug-info-use-after-free.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm-only %s
+// RUN: %clang_cc1 -g -triple %itanium_abi_triple -emit-llvm-only %s
// Check that we don't crash.
// PR12305, PR12315
diff --git a/test/CodeGenCXX/debug-info-uuid.cpp b/test/CodeGenCXX/debug-info-uuid.cpp
index a57e2f0..6137400 100644
--- a/test/CodeGenCXX/debug-info-uuid.cpp
+++ b/test/CodeGenCXX/debug-info-uuid.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -fms-extensions -triple=x86_64-pc-win32 -cxx-abi microsoft -g %s -o - -std=c++11 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fms-extensions -triple=x86_64-pc-win32 -g %s -o - -std=c++11 | FileCheck %s
// RUN: not %clang_cc1 -emit-llvm -fms-extensions -triple=x86_64-unknown-unknown -g %s -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=CHECK-ITANIUM
// CHECK: metadata [[TGIARGS:![0-9]*]], null} ; [ DW_TAG_structure_type ] [tmpl_guid<&__uuidof(uuid)>]
diff --git a/test/CodeGenCXX/debug-info-varargs.cpp b/test/CodeGenCXX/debug-info-varargs.cpp
new file mode 100644
index 0000000..cc92477
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-varargs.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s
+
+struct A
+{
+ // CHECK-DAG: ", i32 [[@LINE+1]], metadata ![[ATY:[0-9]+]]{{.*}}[ DW_TAG_subprogram ]{{.*}}[a]
+ void a(int c, ...) {}
+ // CHECK: ![[ATY]] ={{.*}} metadata ![[AARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ]
+ // CHECK: ![[AARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]}
+ // CHECK: ![[UNSPEC]] = {{.*}} [ DW_TAG_unspecified_parameters ]
+};
+
+ // CHECK: ", i32 [[@LINE+1]], metadata ![[BTY:[0-9]+]]{{.*}}[ DW_TAG_subprogram ]{{.*}}[b]
+void b(int c, ...) {
+ // CHECK: ![[BTY]] ={{.*}} metadata ![[BARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ]
+ // CHECK: ![[BARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]}
+
+ A a;
+
+ // CHECK: metadata ![[PST:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [fptr] [line [[@LINE+1]]]
+ void (*fptr)(int, ...) = b;
+ // CHECK: ![[PST]] ={{.*}} metadata ![[BTY]]} ; [ DW_TAG_pointer_type ]
+}
diff --git a/test/CodeGenCXX/debug-info-vtable-optzn.cpp b/test/CodeGenCXX/debug-info-vtable-optzn.cpp
new file mode 100644
index 0000000..8a6d4ff
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-vtable-optzn.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+//
+// This tests that the "emit debug info for a C++ class only in the
+// module that has its vtable" optimization is disabled by default on
+// Darwin.
+//
+// CHECK: [ DW_TAG_member ] [lost]
+class A
+{
+ virtual bool f() = 0;
+ int lost;
+};
+
+class B : public A
+{
+ B *g();
+};
+
+B *B::g() {
+ return this;
+}
diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp
index 93a4fe3..2e7226d 100644
--- a/test/CodeGenCXX/debug-info.cpp
+++ b/test/CodeGenCXX/debug-info.cpp
@@ -77,7 +77,7 @@
return f; // reference 'f' for now because otherwise we hit another bug
}
-// CHECK: [[FOO:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763:![0-9]*]], {{.*}} ; [ DW_TAG_structure_type ] [foo]
+// CHECK: metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763:![0-9]*]], {{.*}}, metadata !"[[FOO:.*]]"} ; [ DW_TAG_structure_type ] [foo]
// CHECK: [[PR14763]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763]
// CHECK: [[INCTYPE:![0-9]*]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl]
// CHECK: metadata [[A_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTSN7pr162141aE"} ; [ DW_TAG_structure_type ] [a]
@@ -97,7 +97,7 @@
}
// For some reason the argument for PR14763 ended up all the way down here
-// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f]
+// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata !"[[FOO]]", i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f]
namespace pr16214 {
struct a {
diff --git a/test/CodeGenCXX/decl-ref-init.cpp b/test/CodeGenCXX/decl-ref-init.cpp
index 1a82ee2..dbbbe97 100644
--- a/test/CodeGenCXX/decl-ref-init.cpp
+++ b/test/CodeGenCXX/decl-ref-init.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -emit-llvm %s -o - | \
+// RUN: FileCheck %s
struct A {};
@@ -24,8 +23,5 @@
const A& rca2 = d();
}
-// CHECK-LP64: callq __ZN1BcvR1AEv
-// CHECK-LP64: callq __ZN1BcvR1AEv
-
-// CHECK-LP32: calll L__ZN1BcvR1AEv
-// CHECK-LP32: calll L__ZN1BcvR1AEv
+// CHECK: call %struct.A* @_ZN1BcvR1AEv
+// CHECK: call %struct.A* @_ZN1BcvR1AEv
diff --git a/test/CodeGenCXX/default-arguments.cpp b/test/CodeGenCXX/default-arguments.cpp
index 83cae3a..d364835 100644
--- a/test/CodeGenCXX/default-arguments.cpp
+++ b/test/CodeGenCXX/default-arguments.cpp
@@ -42,15 +42,15 @@
C();
};
-// CHECK-LABEL: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
-// CHECK: call void @_ZN1CC2Ev(
-
// CHECK-LABEL: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr
// CHECK: call void @_ZN2A1C1Ev(
// CHECK: call void @_ZN2A2C1Ev(
// CHECK: call void @_ZN1BC1ERK2A1RK2A2(
// CHECK: call void @_ZN2A2D1Ev
// CHECK: call void @_ZN2A1D1Ev
+
+// CHECK-LABEL: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
+// CHECK: call void @_ZN1CC2Ev(
C::C() { }
// CHECK-LABEL: define void @_Z2f3v()
diff --git a/test/CodeGenCXX/default-constructor-default-argument.cpp b/test/CodeGenCXX/default-constructor-default-argument.cpp
index 374a967..17ecc35 100644
--- a/test/CodeGenCXX/default-constructor-default-argument.cpp
+++ b/test/CodeGenCXX/default-constructor-default-argument.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
// Check that call to constructor for struct A is generated correctly.
struct A { A(int x = 2); };
diff --git a/test/CodeGenCXX/default-constructor-for-members.cpp b/test/CodeGenCXX/default-constructor-for-members.cpp
index 6065b49..5eb8cd1 100644
--- a/test/CodeGenCXX/default-constructor-for-members.cpp
+++ b/test/CodeGenCXX/default-constructor-for-members.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | \
+// RUN: FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -emit-llvm %s -o - | \
+// RUN: FileCheck %s
extern "C" int printf(...);
@@ -19,6 +18,4 @@
M m1;
}
-// CHECK-LP64: callq __ZN1SC1Ev
-
-// CHECK-LP32: calll L__ZN1SC1Ev
+// CHECK: call void @_ZN1SC1Ev
diff --git a/test/CodeGenCXX/default-constructor-template-member.cpp b/test/CodeGenCXX/default-constructor-template-member.cpp
index 2156964..93df818 100644
--- a/test/CodeGenCXX/default-constructor-template-member.cpp
+++ b/test/CodeGenCXX/default-constructor-template-member.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
template <class T> struct A { A(); };
struct B { A<int> x; };
diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp
index 565a727..77b06d6 100644
--- a/test/CodeGenCXX/default-destructor-nested.cpp
+++ b/test/CodeGenCXX/default-destructor-nested.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm-only
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm-only
// PR6294
class A {
diff --git a/test/CodeGenCXX/deferred-global-init.cpp b/test/CodeGenCXX/deferred-global-init.cpp
index deb458f..c683ad2 100644
--- a/test/CodeGenCXX/deferred-global-init.cpp
+++ b/test/CodeGenCXX/deferred-global-init.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
// PR5967
extern void* foo;
diff --git a/test/CodeGenCXX/delayed-template-parsing.cpp b/test/CodeGenCXX/delayed-template-parsing.cpp
index fa177d4..c5f4486 100644
--- a/test/CodeGenCXX/delayed-template-parsing.cpp
+++ b/test/CodeGenCXX/delayed-template-parsing.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
namespace ClassScopeSpecialization {
struct Type {
diff --git a/test/CodeGenCXX/delete-two-arg.cpp b/test/CodeGenCXX/delete-two-arg.cpp
index f8e6bff..be3cf1a 100644
--- a/test/CodeGenCXX/delete-two-arg.cpp
+++ b/test/CodeGenCXX/delete-two-arg.cpp
@@ -1,4 +1,5 @@
-// RUN: not %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
+// expected-no-diagnostics
typedef __typeof(sizeof(int)) size_t;
diff --git a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
index f2ecfc1..b7a5554 100644
--- a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
+++ b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
struct A { int i; };
struct B { char j; };
diff --git a/test/CodeGenCXX/destructor-exception-spec.cpp b/test/CodeGenCXX/destructor-exception-spec.cpp
index e111ba0..50c17ef 100644
--- a/test/CodeGenCXX/destructor-exception-spec.cpp
+++ b/test/CodeGenCXX/destructor-exception-spec.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -emit-llvm-only %s -std=c++11
-// RUN: %clang_cc1 -emit-llvm-only -fno-use-cxa-atexit %s -std=c++11
-// RUN: %clang_cc1 -cxx-abi microsoft -fno-rtti -emit-llvm-only %s -std=c++11
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -std=c++11
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only -fno-use-cxa-atexit %s -std=c++11
+// RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm-only %s -std=c++11
// PR13479: don't crash with -fno-exceptions.
namespace {
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index 799cca2..5c43048 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -6,6 +6,13 @@
// CHECK-DAG: @_ZN5test11OD2Ev = alias {{.*}} @_ZN5test11AD2Ev
// CHECK-DAG: @_ZN5test11SD2Ev = alias bitcast {{.*}} @_ZN5test11AD2Ev
+// WIN32-DAG: @_ZN5test01AD1Ev = alias {{.*}} @_ZN5test01AD2Ev
+// WIN32-DAG: @_ZN5test11MD2Ev = alias {{.*}} @_ZN5test11AD2Ev
+// WIN32-DAG: @_ZN5test11ND2Ev = alias {{.*}} @_ZN5test11AD2Ev
+// WIN32-DAG: @_ZN5test11OD2Ev = alias {{.*}} @_ZN5test11AD2Ev
+// WIN32-DAG: @_ZN5test11SD2Ev = alias bitcast {{.*}} @_ZN5test11AD2Ev
+
+
struct A {
int a;
@@ -102,6 +109,12 @@
B::~B() try { } catch (int i) {}
// It will suppress the delegation optimization here, though.
+// CHECK-LABEL: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, i8** %vtt) unnamed_addr
+// CHECK: invoke void @_ZN5test06MemberD1Ev
+// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
+// CHECK: invoke void @_ZN5test04BaseD2Ev
+// CHECK: unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
+
// CHECK-LABEL: define void @_ZN5test01BD1Ev(%"struct.test0::B"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test06MemberD1Ev
// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
@@ -109,12 +122,6 @@
// CHECK: unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
// CHECK: invoke void @_ZN5test05VBaseD2Ev
// CHECK: unwind label [[VBASE_UNWIND:%[a-zA-Z0-9.]+]]
-
-// CHECK-LABEL: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, i8** %vtt) unnamed_addr
-// CHECK: invoke void @_ZN5test06MemberD1Ev
-// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
-// CHECK: invoke void @_ZN5test04BaseD2Ev
-// CHECK: unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
}
// Test base-class aliasing.
@@ -272,14 +279,6 @@
// FIXME: way too much EH cleanup code follows
C::~C() { opaque(); }
- // CHECK-LABEL: define void @_ZN5test61CD1Ev(%"struct.test6::C"* %this) unnamed_addr
- // CHECK: invoke void @_ZN5test61CD2Ev
- // CHECK: invoke void @_ZN5test61BILj3EED2Ev
- // CHECK: call void @_ZN5test61BILj2EED2Ev
- // CHECK: ret void
- // CHECK: invoke void @_ZN5test61BILj3EED2Ev
- // CHECK: invoke void @_ZN5test61BILj2EED2Ev
-
// CHECK-LABEL: define void @_ZN5test61CD2Ev(%"struct.test6::C"* %this, i8** %vtt) unnamed_addr
// CHECK: invoke void @_ZN5test66opaqueEv
// CHECK: invoke void @_ZN5test61AD1Ev
@@ -293,6 +292,14 @@
// CHECK: invoke void @_ZN5test61AD1Ev
// CHECK: invoke void @_ZN5test61BILj1EED2Ev
// CHECK: invoke void @_ZN5test61BILj0EED2Ev
+
+ // CHECK-LABEL: define void @_ZN5test61CD1Ev(%"struct.test6::C"* %this) unnamed_addr
+ // CHECK: invoke void @_ZN5test61CD2Ev
+ // CHECK: invoke void @_ZN5test61BILj3EED2Ev
+ // CHECK: call void @_ZN5test61BILj2EED2Ev
+ // CHECK: ret void
+ // CHECK: invoke void @_ZN5test61BILj3EED2Ev
+ // CHECK: invoke void @_ZN5test61BILj2EED2Ev
}
// PR 9197
@@ -374,7 +381,7 @@
// Checks from test3:
- // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::<anonymous namespace>::D"* %this) unnamed_addr
+ // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::(anonymous namespace)::D"* %this) unnamed_addr
// CHECK: invoke void {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
// CHECK: call void @_ZdlPv({{.*}}) [[NUW:#[0-9]+]]
// CHECK: ret void
@@ -398,7 +405,7 @@
// CHECK: call void @_ZN5test312_GLOBAL__N_11CD2Ev(
// CHECK: ret void
- // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
+ // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test31BD2Ev(
// CHECK: call void @_ZN5test31AD2Ev(
// CHECK: ret void
@@ -406,7 +413,7 @@
// CHECK: declare void @_ZN5test31BD2Ev(
// CHECK: declare void @_ZN5test31AD2Ev(
- // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
+ // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test312_GLOBAL__N_11CD2Ev(
// CHECK: call void @_ZdlPv({{.*}}) [[NUW]]
// CHECK: ret void
diff --git a/test/CodeGenCXX/duplicate-mangled-name.cpp b/test/CodeGenCXX/duplicate-mangled-name.cpp
new file mode 100644
index 0000000..65bfa22
--- /dev/null
+++ b/test/CodeGenCXX/duplicate-mangled-name.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only %s -verify
+
+// rdar://15522601
+class MyClass {
+ static void meth();
+};
+void MyClass::meth() { }
+extern "C" {
+ void _ZN7MyClass4methEv() { } // expected-error {{definition with same mangled name as another definition}}
+}
diff --git a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp
index 0e26de5..cde03a3 100644
--- a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp
+++ b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -verify -fno-rtti -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -verify -fno-rtti -triple %itanium_abi_triple -o - | FileCheck %s
// expected-no-diagnostics
struct A {
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index 2a61e61..c4ec9dd 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -184,9 +184,6 @@
struct A { A(); };
- // CHECK-LABEL: define void @_ZN5test91AC1Ev(%"struct.test9::A"* %this) unnamed_addr
- // CHECK: call void @_ZN5test91AC2Ev
- // CHECK-NEXT: ret void
// CHECK-LABEL: define void @_ZN5test91AC2Ev(%"struct.test9::A"* %this) unnamed_addr
A::A() try {
@@ -199,6 +196,10 @@
// CHECK: call i8* @__cxa_begin_catch
// CHECK: invoke void @_ZN5test96opaqueEv()
// CHECK: invoke void @__cxa_rethrow()
+
+ // CHECK-LABEL: define void @_ZN5test91AC1Ev(%"struct.test9::A"* %this) unnamed_addr
+ // CHECK: call void @_ZN5test91AC2Ev
+ // CHECK-NEXT: ret void
opaque();
}
}
diff --git a/test/CodeGenCXX/elide-call-reference.cpp b/test/CodeGenCXX/elide-call-reference.cpp
index 55d30e2..0ce856f 100644
--- a/test/CodeGenCXX/elide-call-reference.cpp
+++ b/test/CodeGenCXX/elide-call-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// PR5695
struct A { A(const A&); ~A(); };
diff --git a/test/CodeGenCXX/empty-nontrivially-copyable.cpp b/test/CodeGenCXX/empty-nontrivially-copyable.cpp
index 9ee3281..9457293 100644
--- a/test/CodeGenCXX/empty-nontrivially-copyable.cpp
+++ b/test/CodeGenCXX/empty-nontrivially-copyable.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple armv7-apple-ios -x c++ -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-ios -x c++ -emit-llvm -o - %s | FileCheck %s
// According to the Itanium ABI (3.1.1), types with non-trivial copy
// constructors passed by value should be passed indirectly, with the caller
diff --git a/test/CodeGenCXX/exceptions-no-rtti.cpp b/test/CodeGenCXX/exceptions-no-rtti.cpp
index 902d6ac..e1ef4f1 100644
--- a/test/CodeGenCXX/exceptions-no-rtti.cpp
+++ b/test/CodeGenCXX/exceptions-no-rtti.cpp
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
-// CHECK: @_ZTIN5test11AE = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTIN5test11BE = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTIN5test11CE = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTIN5test11DE = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTIPN5test11DE = linkonce_odr unnamed_addr constant {{.*}} @_ZTIN5test11DE
+// CHECK: @_ZTIN5test11AE = linkonce_odr constant
+// CHECK: @_ZTIN5test11BE = linkonce_odr constant
+// CHECK: @_ZTIN5test11CE = linkonce_odr constant
+// CHECK: @_ZTIN5test11DE = linkonce_odr constant
+// CHECK: @_ZTIPN5test11DE = linkonce_odr constant {{.*}} @_ZTIN5test11DE
// PR6974: this shouldn't crash
namespace test0 {
diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp
index 5899b93..63bb177 100644
--- a/test/CodeGenCXX/extern-c.cpp
+++ b/test/CodeGenCXX/extern-c.cpp
@@ -1,18 +1,21 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
namespace foo {
-// CHECK-NOT: @a = global i32
+// CHECK-NOT: @a = global
extern "C" int a;
-// CHECK-NOT: @_ZN3foo1bE = global i32
+// CHECK-NOT: @_ZN3foo1bE = global
extern int b;
-// CHECK: @_ZN3foo1cE = global i32
+// CHECK: @_ZN3foo1cE = global
int c = 5;
// CHECK-NOT: @_ZN3foo1dE
extern "C" struct d;
+// CHECK-NOT: should_not_appear
+extern "C++" int should_not_appear;
+
}
namespace test1 {
diff --git a/test/CodeGenCXX/field-access-debug-info.cpp b/test/CodeGenCXX/field-access-debug-info.cpp
index fd899ed..aed4ee5 100644
--- a/test/CodeGenCXX/field-access-debug-info.cpp
+++ b/test/CodeGenCXX/field-access-debug-info.cpp
@@ -1,8 +1,7 @@
-// RUN: %clang_cc1 -g -S -masm-verbose -o - %s | FileCheck %s
+// RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s
-// CHECK: abbrev_begin:
-// CHECK: DW_AT_accessibility
-// CHECK-NEXT: DW_FORM_data1
+// CHECK: [ DW_TAG_member ] [p] [{{[^]]*}}] [from int]
+// CHECK: [ DW_TAG_member ] [pr] [{{[^]]*}}] [private] [from int]
class A {
public:
diff --git a/test/CodeGenCXX/function-template-explicit-specialization.cpp b/test/CodeGenCXX/function-template-explicit-specialization.cpp
index 5d26dcd..8ff0655 100644
--- a/test/CodeGenCXX/function-template-explicit-specialization.cpp
+++ b/test/CodeGenCXX/function-template-explicit-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
template<typename T> void a(T);
template<> void a(int) {}
diff --git a/test/CodeGenCXX/function-template-specialization.cpp b/test/CodeGenCXX/function-template-specialization.cpp
index 4a79fb1..eb099df 100644
--- a/test/CodeGenCXX/function-template-specialization.cpp
+++ b/test/CodeGenCXX/function-template-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
template<typename T, typename U>
T* next(T* ptr, const U& diff);
diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp
index 2bd43b9..55933ee 100644
--- a/test/CodeGenCXX/global-llvm-constant.cpp
+++ b/test/CodeGenCXX/global-llvm-constant.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
struct A {
A() { x = 10; }
diff --git a/test/CodeGenCXX/implicit-instantiation-1.cpp b/test/CodeGenCXX/implicit-instantiation-1.cpp
index bf6a141..c3c49c3 100644
--- a/test/CodeGenCXX/implicit-instantiation-1.cpp
+++ b/test/CodeGenCXX/implicit-instantiation-1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o %t
template<typename T>
struct X {
diff --git a/test/CodeGenCXX/inheriting-constructor.cpp b/test/CodeGenCXX/inheriting-constructor.cpp
index c99a20c..9394137 100644
--- a/test/CodeGenCXX/inheriting-constructor.cpp
+++ b/test/CodeGenCXX/inheriting-constructor.cpp
@@ -11,9 +11,9 @@
struct D : C { using C::C; };
D d(123);
-// CHECK-LABEL: define void @_ZN1BD0Ev
-// CHECK-LABEL: define void @_ZN1BD1Ev
// CHECK-LABEL: define void @_ZN1BD2Ev
+// CHECK-LABEL: define void @_ZN1BD1Ev
+// CHECK-LABEL: define void @_ZN1BD0Ev
// CHECK-LABEL: define linkonce_odr void @_ZN1BC1Ei(
// CHECK: call void @_ZN1BC2Ei(
diff --git a/test/CodeGenCXX/init-priority-attr.cpp b/test/CodeGenCXX/init-priority-attr.cpp
index ef9343c..b09c65e 100644
--- a/test/CodeGenCXX/init-priority-attr.cpp
+++ b/test/CodeGenCXX/init-priority-attr.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
-// PR
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O2 -emit-llvm -o - | FileCheck %s
+// PR11480
void foo(int);
@@ -30,15 +30,18 @@
// CHECK: @llvm.global_ctors = appending global [3 x { i32, void ()* }] [{ i32, void ()* } { i32 200, void ()* @_GLOBAL__I_000200 }, { i32, void ()* } { i32 300, void ()* @_GLOBAL__I_000300 }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
// CHECK: _GLOBAL__I_000200()
-// CHECK_NEXT: _Z3fooi(i32 3)
+// CHECK: _Z3fooi(i32 3)
+// CHECK-NEXT: ret void
// CHECK: _GLOBAL__I_000300()
-// CHECK_NEXT: _Z3fooi(i32 2)
-// CHECK_NEXT: _Z3fooi(i32 1)
+// CHECK: _Z3fooi(i32 2)
+// CHECK-NEXT: _Z3fooi(i32 1)
+// CHECK-NEXT: ret void
// CHECK: _GLOBAL__I_a()
-// CHECK_NEXT: _Z3fooi(i32 1)
-// CHECK_NEXT: _Z3fooi(i32 4)
+// CHECK: _Z3fooi(i32 1)
+// CHECK-NEXT: _Z3fooi(i32 4)
+// CHECK-NEXT: ret void
C c;
A1 a1 __attribute__((init_priority (300)));
diff --git a/test/CodeGenCXX/inline-functions.cpp b/test/CodeGenCXX/inline-functions.cpp
index 9f8e536..622cfa9 100644
--- a/test/CodeGenCXX/inline-functions.cpp
+++ b/test/CodeGenCXX/inline-functions.cpp
@@ -1,11 +1,12 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NORMAL
+// RUN: %clang_cc1 %s -std=c++11 -fms-compatibility -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSVCCOMPAT
// CHECK: ; ModuleID
struct A {
inline void f();
};
-// CHECK-NOT-LABEL: define void @_ZN1A1fEv
+// CHECK-NOT: define void @_ZN1A1fEv
void A::f() { }
template<typename> struct B { };
@@ -67,3 +68,56 @@
}
// CHECK-LABEL: define linkonce_odr void @_ZN5test21fERKNS_1AE
}
+
+// MSVCCOMPAT-LABEL: define weak_odr void @_Z17ExternAndInlineFnv
+// NORMAL-NOT: _Z17ExternAndInlineFnv
+extern inline void ExternAndInlineFn() {}
+
+// MSVCCOMPAT-LABEL: define weak_odr void @_Z18InlineThenExternFnv
+// NORMAL-NOT: _Z18InlineThenExternFnv
+inline void InlineThenExternFn() {}
+extern void InlineThenExternFn();
+
+// CHECK-LABEL: define void @_Z18ExternThenInlineFnv
+extern void ExternThenInlineFn() {}
+
+// MSVCCOMPAT-LABEL: define weak_odr void @_Z25ExternThenInlineThenDefFnv
+// NORMAL-NOT: _Z25ExternThenInlineThenDefFnv
+extern void ExternThenInlineThenDefFn();
+inline void ExternThenInlineThenDefFn();
+void ExternThenInlineThenDefFn() {}
+
+// MSVCCOMPAT-LABEL: define weak_odr void @_Z25InlineThenExternThenDefFnv
+// NORMAL-NOT: _Z25InlineThenExternThenDefFnv
+inline void InlineThenExternThenDefFn();
+extern void InlineThenExternThenDefFn();
+void InlineThenExternThenDefFn() {}
+
+// MSVCCOMPAT-LABEL: define weak_odr i32 @_Z20ExternAndConstexprFnv
+// NORMAL-NOT: _Z17ExternAndConstexprFnv
+extern constexpr int ExternAndConstexprFn() { return 0; }
+
+// CHECK-NOT: _Z11ConstexprFnv
+constexpr int ConstexprFn() { return 0; }
+
+template <typename T>
+extern inline void ExternInlineOnPrimaryTemplate(T);
+
+// CHECK-LABEL: define void @_Z29ExternInlineOnPrimaryTemplateIiEvT_
+template <>
+void ExternInlineOnPrimaryTemplate(int) {}
+
+template <typename T>
+extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(T);
+
+// MSVCCOMPAT-LABEL: define weak_odr void @_Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_
+// NORMAL-NOT: _Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_
+template <>
+extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(int) {}
+
+struct TypeWithInlineMethods {
+ // CHECK-NOT: _ZN21TypeWithInlineMethods9StaticFunEv
+ static void StaticFun() {}
+ // CHECK-NOT: _ZN21TypeWithInlineMethods12NonStaticFunEv
+ void NonStaticFun() { StaticFun(); }
+};
diff --git a/test/CodeGenCXX/instrument-functions.cpp b/test/CodeGenCXX/instrument-functions.cpp
index 253e096..587b638 100644
--- a/test/CodeGenCXX/instrument-functions.cpp
+++ b/test/CodeGenCXX/instrument-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
// CHECK: @_Z5test1i
int test1(int x) {
diff --git a/test/CodeGenCXX/int64_uint64.cpp b/test/CodeGenCXX/int64_uint64.cpp
new file mode 100644
index 0000000..3ec976a
--- /dev/null
+++ b/test/CodeGenCXX/int64_uint64.cpp
@@ -0,0 +1,25 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -triple arm-linux-guneabi \
+// RUN: -target-cpu cortex-a8 \
+// RUN: -emit-llvm -w -O1 -o - %s | FileCheck --check-prefix=CHECK-ARM %s
+
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-linux-gnueabi \
+// RUN: -target-feature +neon \
+// RUN: -emit-llvm -w -O1 -o - %s | FileCheck --check-prefix=CHECK-AARCH64 %s
+
+// Test if int64_t and uint64_t can be correctly mangled.
+
+#include "arm_neon.h"
+// CHECK-ARM: f1x(
+// CHECK-AARCH64: f1l(
+void f1(int64_t a) {}
+// CHECK-ARM: f2y(
+// CHECK-AARCH64: f2m(
+void f2(uint64_t a) {}
+// CHECK-ARM: f3Px(
+// CHECK-AARCH64: f3Pl(
+void f3(int64_t *ptr) {}
+// CHECK-ARM: f4Py(
+// CHECK-AARCH64: f4Pm(
+void f4(uint64_t *ptr) {}
diff --git a/test/CodeGenCXX/internal-linkage.cpp b/test/CodeGenCXX/internal-linkage.cpp
index 56cb810..77b1670 100644
--- a/test/CodeGenCXX/internal-linkage.cpp
+++ b/test/CodeGenCXX/internal-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
struct Global { Global(); };
template<typename T> struct X { X() {} };
diff --git a/test/CodeGenCXX/linetable-cleanup.cpp b/test/CodeGenCXX/linetable-cleanup.cpp
index 96b8572..ce7f2c6 100644
--- a/test/CodeGenCXX/linetable-cleanup.cpp
+++ b/test/CodeGenCXX/linetable-cleanup.cpp
@@ -46,12 +46,14 @@
void baz()
{
if (!foo())
- // CHECK: {{.*}} = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+ // CHECK: ![[SCOPE1:.*]] = metadata !{{{.*}}, i32 [[@LINE-1]], {{.*}}} ; [ DW_TAG_lexical_block ]
+ // CHECK: {{.*}} = metadata !{i32 [[@LINE+1]], i32 0, metadata ![[SCOPE1]], null}
return;
if (foo()) {
// no cleanup
- // CHECK: {{.*}} = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+ // CHECK: {{.*}} = metadata !{i32 [[@LINE+2]], i32 0, metadata ![[SCOPE2:.*]], null}
+ // CHECK: ![[SCOPE2]] = metadata !{{{.*}}, i32 [[@LINE-3]], {{.*}}} ; [ DW_TAG_lexical_block ]
return;
}
// CHECK: ![[RETBAZ]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
diff --git a/test/CodeGenCXX/linetable-eh.cpp b/test/CodeGenCXX/linetable-eh.cpp
new file mode 100644
index 0000000..14a5067
--- /dev/null
+++ b/test/CodeGenCXX/linetable-eh.cpp
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-macosx10.9.0 -munwind-tables -std=c++11 -fcxx-exceptions -fexceptions %s -o - | FileCheck %s
+
+// Test that emitting a landing pad does not affect the line table
+// entries for the code that triggered it.
+
+// CHECK: call void @llvm.dbg.declare
+// CHECK: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[CURRENT_ADDR:.*]]), !dbg ![[DBG1:.*]]
+// CHECK: unwind label %{{.*}}, !dbg ![[DBG1]]
+// CHECK: store i64 %{{.*}}, i64* %current_address, align 8, !dbg ![[DBG4:.*]]
+// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[FOUND_IT:.*]]), !dbg ![[DBG2:.*]]
+// CHECK: = landingpad
+// CHECK-NEXT: cleanup, !dbg ![[DBG3:.*]]
+// CHECK-DAG: ![[CURRENT_ADDR]] = {{.*}} [current_address]
+// CHECK-DAG: ![[FOUND_IT]] = {{.*}} [found_it]
+// CHECK-DAG: ![[DBG1]] = metadata !{i32 256,
+// CHECK-DAG: ![[DBG2]] = metadata !{i32 257,
+// CHECK-DAG: ![[DBG3]] = metadata !{i32 268,
+// CHECK-DAG: ![[DBG4]] = metadata !{i32 256,
+typedef unsigned long long uint64_t;
+template<class _Tp> class shared_ptr {
+public:
+ typedef _Tp element_type;
+ element_type* __ptr_;
+ ~shared_ptr();
+ element_type* operator->() const noexcept {return __ptr_;}
+};
+class Context {
+public:
+ uint64_t GetIt();
+};
+class Foo
+{
+ bool bar();
+ virtual shared_ptr<Context> GetContext () = 0;
+};
+# 253 "Foo.cpp" 3
+bool
+Foo::bar ()
+{
+ uint64_t current_address = GetContext()->GetIt();
+ bool found_it = false;
+# 267 "Foo.cpp" 3
+ return found_it;
+}
diff --git a/test/CodeGenCXX/linetable-fnbegin.cpp b/test/CodeGenCXX/linetable-fnbegin.cpp
new file mode 100644
index 0000000..ce46306
--- /dev/null
+++ b/test/CodeGenCXX/linetable-fnbegin.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// Test that the line table info for Foo<T>::bar() is pointing to the
+// right header file.
+// CHECK: define{{.*}}bar
+// CHECK-NOT: define
+// CHECK: ret {{.*}}, !dbg [[DBG:.*]]
+// CHECK: [[HPP:.*]] = metadata !{metadata !"./template.hpp",
+// CHECK: [[SP:.*]] = metadata !{i32 786478, metadata [[HPP]],{{.*}}[ DW_TAG_subprogram ] [line 22] [def] [bar]
+// We shouldn't need a lexical block for this function.
+// CHECK: [[DBG]] = metadata !{i32 23, i32 0, metadata [[SP]], null}
+
+
+# 1 "./template.h" 1
+template <typename T>
+class Foo {
+public:
+ int bar();
+};
+# 21 "./template.hpp"
+template <typename T>
+int Foo<T>::bar() {
+ return 23;
+}
+int main (int argc, const char * argv[])
+{
+ Foo<int> f;
+ return f.bar();
+}
diff --git a/test/CodeGenCXX/linkage.cpp b/test/CodeGenCXX/linkage.cpp
index 19f1b20..60e53c6 100644
--- a/test/CodeGenCXX/linkage.cpp
+++ b/test/CodeGenCXX/linkage.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -std=c++11 -O1 -disable-llvm-optzns %s -o - | FileCheck %s
namespace test1 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test11fIZNS_1gEvE1SEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test11fIZNS_1gEvE1SEEvT_(
template <typename T> void f(T) {}
inline void *g() {
struct S {
@@ -12,7 +12,7 @@
}
namespace test2 {
- // CHECK-DAG-LABEL: define internal void @_ZN5test21fIZNS_L1gEvE1SEEvT_(
+ // CHECK-DAG: define internal void @_ZN5test21fIZNS_L1gEvE1SEEvT_(
template <typename T> void f(T) {}
static inline void *g() {
struct S {
@@ -23,7 +23,7 @@
}
namespace test3 {
- // CHECK-DAG-LABEL: define internal void @_ZN5test31fIZNS_1gEvE1SEEvT_(
+ // CHECK-DAG: define internal void @_ZN5test31fIZNS_1gEvE1SEEvT_(
template <typename T> void f(T) {}
void *g() {
struct S {
@@ -34,7 +34,7 @@
}
namespace test4 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test41fIZNS_1gILi1EEEPvvE1SEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test41fIZNS_1gILi1EEEPvvE1SEEvT_(
template <typename T> void f(T) {}
template <int N> inline void *g() {
struct S {
@@ -46,7 +46,7 @@
}
namespace test5 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test51fIZNS_1gILi1EEEPvvE1SEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test51fIZNS_1gILi1EEEPvvE1SEEvT_(
template <typename T> void f(T) {}
template <int N> inline void *g() {
struct S {
@@ -58,7 +58,7 @@
}
namespace test6 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test61fIZZNS_1gEvEN1S1hEvE1TEEvv(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test61fIZZNS_1gEvEN1S1hEvE1TEEvv(
template <typename T> void f() {}
inline void *g() {
@@ -76,7 +76,7 @@
}
namespace test7 {
- // CHECK-DAG-LABEL: define internal void @_ZN5test71fIZZNS_1gEvEN1S1hEvE1TEEvv(
+ // CHECK-DAG: define internal void @_ZN5test71fIZZNS_1gEvEN1S1hEvE1TEEvv(
template <typename T> void f() {}
void *g() {
@@ -94,7 +94,7 @@
}
namespace test8 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test81fIZNS_1gEvE1SEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test81fIZNS_1gEvE1SEEvT_(
template <typename T> void f(T) {}
inline void *g() {
enum S {
@@ -105,7 +105,7 @@
}
namespace test9 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN5test91fIPZNS_1gEvE1SEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN5test91fIPZNS_1gEvE1SEEvT_(
template <typename T> void f(T) {}
inline void *g() {
struct S {
@@ -116,7 +116,7 @@
}
namespace test10 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN6test101fIPFZNS_1gEvE1SvEEEvT_(
+ // CHECK-DAG: define linkonce_odr void @_ZN6test101fIPFZNS_1gEvE1SvEEEvT_(
template <typename T> void f(T) {}
inline void *g() {
struct S {
@@ -128,7 +128,7 @@
}
namespace test11 {
- // CHECK-DAG-LABEL: define internal void @_ZN6test111fIPFZNS_1gEvE1SPNS_12_GLOBAL__N_11IEEEEvT_(
+ // CHECK-DAG: define internal void @_ZN6test111fIPFZNS_1gEvE1SPNS_12_GLOBAL__N_11IEEEEvT_(
namespace {
struct I {
};
@@ -145,7 +145,7 @@
}
namespace test12 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN6test123fooIZNS_3barIZNS_3zedEvE2S2EEPvvE2S1EEvv
+ // CHECK-DAG: define linkonce_odr void @_ZN6test123fooIZNS_3barIZNS_3zedEvE2S2EEPvvE2S1EEvv
template <typename T> void foo() {}
template <typename T> inline void *bar() {
enum S1 {
@@ -161,7 +161,7 @@
}
namespace test13 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZZN6test133fooEvEN1S3barEv(
+ // CHECK-DAG: define linkonce_odr void @_ZZN6test133fooEvEN1S3barEv(
inline void *foo() {
struct S {
static void bar() {}
@@ -172,7 +172,7 @@
}
namespace test14 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN6test143fooIZNS_1fEvE1SE3barILPS1_0EEEvv(
+ // CHECK-DAG: define linkonce_odr void @_ZN6test143fooIZNS_1fEvE1SE3barILPS1_0EEEvv(
template <typename T> struct foo {
template <T *P> static void bar() {}
static void *g() { return (void *)bar<nullptr>; }
@@ -186,7 +186,7 @@
}
namespace test15 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN6test153zedIZNS_3fooIiEEPvvE3barEEvv(
+ // CHECK-DAG: define linkonce_odr void @_ZN6test153zedIZNS_3fooIiEEPvvE3barEEvv(
template <class T> void zed() {}
template <class T> void *foo() {
class bar {
@@ -197,7 +197,7 @@
}
namespace test16 {
- // CHECK-DAG-LABEL: define linkonce_odr void @_ZN6test163zedIZNS_3fooIiE3barEvE1SEEvv(
+ // CHECK-DAG: define linkonce_odr void @_ZN6test163zedIZNS_3fooIiE3barEvE1SEEvv(
template <class T> void zed() {}
template <class T> struct foo {
static void *bar();
@@ -212,7 +212,7 @@
namespace test17 {
// CHECK-DAG: @_ZZN6test173fooILi42EEEPivE3bar = linkonce_odr
- // CHECK-DAG-LABEL: define weak_odr i32* @_ZN6test173fooILi42EEEPiv(
+ // CHECK-DAG: define weak_odr i32* @_ZN6test173fooILi42EEEPiv(
template<int I>
int *foo() {
static int bar;
@@ -220,3 +220,11 @@
}
template int *foo<42>();
}
+
+// PR18408
+namespace test18 {
+ template<template<typename> class> struct A {};
+ struct B { template<typename> struct C; };
+ void f(A<B::C>) {}
+ // CHECK-DAG: define void @_ZN6test181fENS_1AINS_1B1CEEE(
+}
diff --git a/test/CodeGenCXX/mangle-abi-examples.cpp b/test/CodeGenCXX/mangle-abi-examples.cpp
index 7124078..6fb82cf 100644
--- a/test/CodeGenCXX/mangle-abi-examples.cpp
+++ b/test/CodeGenCXX/mangle-abi-examples.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// CHECK: @_ZTVZ3foovEN1C1DE =
// CHECK: @_ZTVZN1A3fooEiE1B =
diff --git a/test/CodeGenCXX/mangle-address-space.cpp b/test/CodeGenCXX/mangle-address-space.cpp
index 4a4a1f3..a0b3c1a 100644
--- a/test/CodeGenCXX/mangle-address-space.cpp
+++ b/test/CodeGenCXX/mangle-address-space.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
// CHECK-LABEL: define void @_Z2f0Pc
void f0(char *p) { }
diff --git a/test/CodeGenCXX/mangle-alias-template.cpp b/test/CodeGenCXX/mangle-alias-template.cpp
index b6719c5..1dbb3eb 100644
--- a/test/CodeGenCXX/mangle-alias-template.cpp
+++ b/test/CodeGenCXX/mangle-alias-template.cpp
@@ -11,10 +11,6 @@
template<template<typename> class F> void h(F<int>);
-template<typename,typename,typename> struct S {};
-template<typename T, typename U> using U = S<T, int, U>;
-template<typename...Ts> void h(U<Ts...>, Ts...);
-
// CHECK-LABEL: define void @_Z1zv(
void z() {
vector<int> VI;
@@ -42,7 +38,4 @@
Vec<Vec<int>> VVI;
g(VVI);
// CHECK: call void @_Z1gI6vectorIS0_Ii5allocIiEES1_IS3_EEEvT_(
-
- // CHECK: call void @_Z1hIJidEEv1UIDpT_ES2_
- h({}, 0, 0.0);
}
diff --git a/test/CodeGenCXX/mangle-local-class-names.cpp b/test/CodeGenCXX/mangle-local-class-names.cpp
index 8b950fc..848e460 100644
--- a/test/CodeGenCXX/mangle-local-class-names.cpp
+++ b/test/CodeGenCXX/mangle-local-class-names.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// CHECK: @_ZZ4FUNCvEN4SSSSC1ERKf
// CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf
diff --git a/test/CodeGenCXX/mangle-local-class-vtables.cpp b/test/CodeGenCXX/mangle-local-class-vtables.cpp
index d9d3afe..078d735 100644
--- a/test/CodeGenCXX/mangle-local-class-vtables.cpp
+++ b/test/CodeGenCXX/mangle-local-class-vtables.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// CHECK: @_ZTVZN1J1KEvE1C = {{.*}} @_ZTIZN1J1KEvE1C {{.*}} @_ZZN1J1KEvENK1C1FEv
// CHECK: @_ZTIZN1J1KEvE1C = {{.*}} @_ZTSZN1J1KEvE1C
diff --git a/test/CodeGenCXX/mangle-local-classes-nested.cpp b/test/CodeGenCXX/mangle-local-classes-nested.cpp
index fafa5d4..cee541f 100644
--- a/test/CodeGenCXX/mangle-local-classes-nested.cpp
+++ b/test/CodeGenCXX/mangle-local-classes-nested.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// CHECK: @_ZTVZZ1HvEN1S1IEvE1S =
diff --git a/test/CodeGenCXX/mangle-ms-abi-examples.cpp b/test/CodeGenCXX/mangle-ms-abi-examples.cpp
index d6726ca..5dc9d2e 100644
--- a/test/CodeGenCXX/mangle-ms-abi-examples.cpp
+++ b/test/CodeGenCXX/mangle-ms-abi-examples.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -fno-rtti -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
// CHECK: @"\01??_7D@C@?1??foo@@YAXXZ@6B@" =
// CHECK: @"\01??_7B@?1??foo@A@@QAEXH@Z@6B@" =
@@ -11,7 +11,7 @@
B();
}
};
-void foo () {
+inline void foo () {
struct C {
struct D { virtual ~D() {} };
void bar () {
@@ -25,4 +25,6 @@
C::D();
C().bar();
}
-
+void call () {
+ foo();
+}
diff --git a/test/CodeGenCXX/mangle-ms-arg-qualifiers.cpp b/test/CodeGenCXX/mangle-ms-arg-qualifiers.cpp
index 50a2383..fae2e1a 100644
--- a/test/CodeGenCXX/mangle-ms-arg-qualifiers.cpp
+++ b/test/CodeGenCXX/mangle-ms-arg-qualifiers.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 | FileCheck -check-prefix=X64 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck -check-prefix=X64 %s
void foo(const unsigned int) {}
// CHECK: "\01?foo@@YAXI@Z"
@@ -37,6 +37,22 @@
// CHECK: "\01?foo_sad@@YAXSAD@Z"
// X64: "\01?foo_sad@@YAXSEAD@Z"
+void foo_piad(char * __restrict x) {}
+// CHECK: "\01?foo_piad@@YAXPIAD@Z"
+// X64: "\01?foo_piad@@YAXPEIAD@Z"
+
+void foo_qiad(char * const __restrict x) {}
+// CHECK: "\01?foo_qiad@@YAXQIAD@Z"
+// X64: "\01?foo_qiad@@YAXQEIAD@Z"
+
+void foo_riad(char * volatile __restrict x) {}
+// CHECK: "\01?foo_riad@@YAXRIAD@Z"
+// X64: "\01?foo_riad@@YAXREIAD@Z"
+
+void foo_siad(char * const volatile __restrict x) {}
+// CHECK: "\01?foo_siad@@YAXSIAD@Z"
+// X64: "\01?foo_siad@@YAXSEIAD@Z"
+
void foo_papad(char ** x) {}
// CHECK: "\01?foo_papad@@YAXPAPAD@Z"
// X64: "\01?foo_papad@@YAXPEAPEAD@Z"
@@ -238,3 +254,7 @@
void mangle_yes_backref3(ptr_to_fun_type *const, void (**const)(void)) {}
// CHECK: "\01?mangle_yes_backref3@@YAXQAP6AXXZ0@Z"
// X64: "\01?mangle_yes_backref3@@YAXQEAP6AXXZ0@Z"
+
+void mangle_yes_backref4(int *const __restrict, int *const __restrict) {}
+// CHECK: "\01?mangle_yes_backref4@@YAXQIAH0@Z"
+// X64: "\01?mangle_yes_backref4@@YAXQEIAH0@Z"
diff --git a/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
index e10cc8e..5d4b672 100644
--- a/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
+++ b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
template<class X, class Y, class Z>
class A {};
diff --git a/test/CodeGenCXX/mangle-ms-back-references.cpp b/test/CodeGenCXX/mangle-ms-back-references.cpp
index 4f17326..25a058a 100644
--- a/test/CodeGenCXX/mangle-ms-back-references.cpp
+++ b/test/CodeGenCXX/mangle-ms-back-references.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
void f1(const char* a, const char* b) {}
// CHECK: "\01?f1@@YAXPBD0@Z"
diff --git a/test/CodeGenCXX/mangle-ms-cxx11.cpp b/test/CodeGenCXX/mangle-ms-cxx11.cpp
index 6947a53..3acd7a2 100644
--- a/test/CodeGenCXX/mangle-ms-cxx11.cpp
+++ b/test/CodeGenCXX/mangle-ms-cxx11.cpp
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+
+// CHECK: "\01?DeducedType@@3HA"
+auto DeducedType = 30;
// CHECK: "\01?LRef@@YAXAAH@Z"
void LRef(int& a) { }
@@ -9,3 +12,110 @@
// CHECK: "\01?Null@@YAX$$T@Z"
namespace std { typedef decltype(__nullptr) nullptr_t; }
void Null(std::nullptr_t) {}
+
+namespace EnumMangling {
+ extern enum Enum01 { } Enum;
+ extern enum Enum02 : bool { } BoolEnum;
+ extern enum Enum03 : char { } CharEnum;
+ extern enum Enum04 : signed char { } SCharEnum;
+ extern enum Enum05 : unsigned char { } UCharEnum;
+ extern enum Enum06 : short { } SShortEnum;
+ extern enum Enum07 : unsigned short { } UShortEnum;
+ extern enum Enum08 : int { } SIntEnum;
+ extern enum Enum09 : unsigned int { } UIntEnum;
+ extern enum Enum10 : long { } SLongEnum;
+ extern enum Enum11 : unsigned long { } ULongEnum;
+ extern enum Enum12 : long long { } SLongLongEnum;
+ extern enum Enum13 : unsigned long long { } ULongLongEnum;
+// CHECK-DAG: @"\01?Enum@EnumMangling@@3W4Enum01@1@A"
+// CHECK-DAG: @"\01?BoolEnum@EnumMangling@@3W4Enum02@1@A
+// CHECK-DAG: @"\01?CharEnum@EnumMangling@@3W4Enum03@1@A
+// CHECK-DAG: @"\01?SCharEnum@EnumMangling@@3W4Enum04@1@A
+// CHECK-DAG: @"\01?UCharEnum@EnumMangling@@3W4Enum05@1@A
+// CHECK-DAG: @"\01?SShortEnum@EnumMangling@@3W4Enum06@1@A"
+// CHECK-DAG: @"\01?UShortEnum@EnumMangling@@3W4Enum07@1@A"
+// CHECK-DAG: @"\01?SIntEnum@EnumMangling@@3W4Enum08@1@A"
+// CHECK-DAG: @"\01?UIntEnum@EnumMangling@@3W4Enum09@1@A"
+// CHECK-DAG: @"\01?SLongEnum@EnumMangling@@3W4Enum10@1@A"
+// CHECK-DAG: @"\01?ULongEnum@EnumMangling@@3W4Enum11@1@A"
+// CHECK-DAG: @"\01?SLongLongEnum@EnumMangling@@3W4Enum12@1@A"
+// CHECK-DAG: @"\01?ULongLongEnum@EnumMangling@@3W4Enum13@1@A"
+ decltype(Enum) *UseEnum() { return &Enum; }
+ decltype(BoolEnum) *UseBoolEnum() { return &BoolEnum; }
+ decltype(CharEnum) *UseCharEnum() { return &CharEnum; }
+ decltype(SCharEnum) *UseSCharEnum() { return &SCharEnum; }
+ decltype(UCharEnum) *UseUCharEnum() { return &UCharEnum; }
+ decltype(SShortEnum) *UseSShortEnum() { return &SShortEnum; }
+ decltype(UShortEnum) *UseUShortEnum() { return &UShortEnum; }
+ decltype(SIntEnum) *UseSIntEnum() { return &SIntEnum; }
+ decltype(UIntEnum) *UseUIntEnum() { return &UIntEnum; }
+ decltype(SLongEnum) *UseSLongEnum() { return &SLongEnum; }
+ decltype(ULongEnum) *UseULongEnum() { return &ULongEnum; }
+ decltype(SLongLongEnum) *UseSLongLongEnum() { return &SLongLongEnum; }
+ decltype(ULongLongEnum) *UseULongLongEnum() { return &ULongLongEnum; }
+ extern enum class EnumClass01 { } EnumClass;
+ extern enum class EnumClass02 : bool { } BoolEnumClass;
+ extern enum class EnumClass03 : char { } CharEnumClass;
+ extern enum class EnumClass04 : signed char { } SCharEnumClass;
+ extern enum class EnumClass05 : unsigned char { } UCharEnumClass;
+ extern enum class EnumClass06 : short { } SShortEnumClass;
+ extern enum class EnumClass07 : unsigned short { } UShortEnumClass;
+ extern enum class EnumClass08 : int { } SIntEnumClass;
+ extern enum class EnumClass09 : unsigned int { } UIntEnumClass;
+ extern enum class EnumClass10 : long { } SLongEnumClass;
+ extern enum class EnumClass11 : unsigned long { } ULongEnumClass;
+ extern enum class EnumClass12 : long long { } SLongLongEnumClass;
+ extern enum class EnumClass13 : unsigned long long { } ULongLongEnumClass;
+// CHECK-DAG: @"\01?EnumClass@EnumMangling@@3W4EnumClass01@1@A"
+// CHECK-DAG: @"\01?BoolEnumClass@EnumMangling@@3W4EnumClass02@1@A
+// CHECK-DAG: @"\01?CharEnumClass@EnumMangling@@3W4EnumClass03@1@A
+// CHECK-DAG: @"\01?SCharEnumClass@EnumMangling@@3W4EnumClass04@1@A
+// CHECK-DAG: @"\01?UCharEnumClass@EnumMangling@@3W4EnumClass05@1@A
+// CHECK-DAG: @"\01?SShortEnumClass@EnumMangling@@3W4EnumClass06@1@A"
+// CHECK-DAG: @"\01?UShortEnumClass@EnumMangling@@3W4EnumClass07@1@A"
+// CHECK-DAG: @"\01?SIntEnumClass@EnumMangling@@3W4EnumClass08@1@A"
+// CHECK-DAG: @"\01?UIntEnumClass@EnumMangling@@3W4EnumClass09@1@A"
+// CHECK-DAG: @"\01?SLongEnumClass@EnumMangling@@3W4EnumClass10@1@A"
+// CHECK-DAG: @"\01?ULongEnumClass@EnumMangling@@3W4EnumClass11@1@A"
+// CHECK-DAG: @"\01?SLongLongEnumClass@EnumMangling@@3W4EnumClass12@1@A"
+// CHECK-DAG: @"\01?ULongLongEnumClass@EnumMangling@@3W4EnumClass13@1@A"
+ decltype(EnumClass) *UseEnumClass() { return &EnumClass; }
+ decltype(BoolEnumClass) *UseBoolEnumClass() { return &BoolEnumClass; }
+ decltype(CharEnumClass) *UseCharEnumClass() { return &CharEnumClass; }
+ decltype(SCharEnumClass) *UseSCharEnumClass() { return &SCharEnumClass; }
+ decltype(UCharEnumClass) *UseUCharEnumClass() { return &UCharEnumClass; }
+ decltype(SShortEnumClass) *UseSShortEnumClass() { return &SShortEnumClass; }
+ decltype(UShortEnumClass) *UseUShortEnumClass() { return &UShortEnumClass; }
+ decltype(SIntEnumClass) *UseSIntEnumClass() { return &SIntEnumClass; }
+ decltype(UIntEnumClass) *UseUIntEnumClass() { return &UIntEnumClass; }
+ decltype(SLongEnumClass) *UseSLongEnumClass() { return &SLongEnumClass; }
+ decltype(ULongEnumClass) *UseULongEnumClass() { return &ULongEnumClass; }
+ decltype(SLongLongEnumClass) *UseSLongLongEnumClass() { return &SLongLongEnumClass; }
+ decltype(ULongLongEnumClass) *UseULongLongEnumClass() { return &ULongLongEnumClass; }
+}
+
+namespace PR18022 {
+
+struct { } a;
+decltype(a) fun(decltype(a) x, decltype(a)) { return x; }
+// CHECK-DAG: ?fun@PR18022@@YA?AU<unnamed-type-a>@1@U21@0@Z
+
+}
+
+inline int define_lambda() {
+ static auto lambda = [] { static int local; ++local; return local; };
+// First, we have the static local variable of type "<lambda_1>" inside of
+// "define_lambda".
+// CHECK-DAG: ?lambda@?1??define_lambda@@YAHXZ@4V<lambda_1>@@A
+// Next, we have the "operator()" for "<lambda_1>" which is inside of
+// "define_lambda".
+// CHECK-DAG: ??R<lambda_1>@?define_lambda@@YAHXZ@QBEHXZ
+// Finally, we have the local which is inside of "<lambda_1>" which is inside of
+// "define_lambda". Hooray.
+// CHECK-DAG: ?local@?2???R<lambda_1>@?define_lambda@@YAHXZ@QBEHXZ@4HA
+ return lambda();
+}
+
+int call_lambda() {
+ return define_lambda();
+}
diff --git a/test/CodeGenCXX/mangle-ms-cxx14.cpp b/test/CodeGenCXX/mangle-ms-cxx14.cpp
new file mode 100644
index 0000000..0399561
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ms-cxx14.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -std=c++1y -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+
+template <typename> int x = 0;
+
+// CHECK: "\01??$x@X@@3HA"
+template <> int x<void>;
+// CHECK: "\01??$x@H@@3HA"
+template <> int x<int>;
+
+// CHECK: "\01?FunctionWithLocalType@@YA?A?<auto>@@XZ"
+auto FunctionWithLocalType() {
+ struct LocalType {};
+ return LocalType{};
+}
+
+// CHECK: "\01?ValueFromFunctionWithLocalType@@3ULocalType@?0??FunctionWithLocalType@@YA?A?<auto>@@XZ@A"
+auto ValueFromFunctionWithLocalType = FunctionWithLocalType();
+
+// CHECK: "\01??R<lambda_0>@@QBE?A?<auto>@@XZ"
+auto LambdaWithLocalType = [] {
+ struct LocalType {};
+ return LocalType{};
+};
+
+// CHECK: "\01?ValueFromLambdaWithLocalType@@3ULocalType@?0???R<lambda_0>@@QBE?A?<auto>@@XZ@A"
+auto ValueFromLambdaWithLocalType = LambdaWithLocalType();
+
+template <typename T>
+auto TemplateFuncionWithLocalLambda(T) {
+ auto LocalLambdaWithLocalType = []() {
+ struct LocalType {};
+ return LocalType{};
+ };
+ return LocalLambdaWithLocalType();
+}
+
+// CHECK: "\01?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBA?A?3@XZ@A"
+// CHECK: "\01??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z"
+// CHECK: "\01??R<lambda_1>@??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBA?A?1@XZ"
+auto ValueFromTemplateFuncionWithLocalLambda = TemplateFuncionWithLocalLambda(0);
diff --git a/test/CodeGenCXX/mangle-ms-return-qualifiers.cpp b/test/CodeGenCXX/mangle-ms-return-qualifiers.cpp
index 87e04c6..37bbf09 100644
--- a/test/CodeGenCXX/mangle-ms-return-qualifiers.cpp
+++ b/test/CodeGenCXX/mangle-ms-return-qualifiers.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
void a1() {}
// CHECK: "\01?a1@@YAXXZ"
@@ -164,6 +164,12 @@
int S::* const f9() { return 0; }
// CHECK: "\01?f9@@YAQQS@@HXZ"
+int S::* __restrict f10() { return 0; }
+// CHECK: "\01?f10@@YAPIQS@@HXZ"
+
+int S::* const __restrict f11() { return 0; }
+// CHECK: "\01?f11@@YAQIQS@@HXZ"
+
typedef int (*function_pointer)(int);
function_pointer g1() { return 0; }
diff --git a/test/CodeGenCXX/mangle-ms-string-literals.cpp b/test/CodeGenCXX/mangle-ms-string-literals.cpp
new file mode 100644
index 0000000..a77a04f
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ms-string-literals.cpp
@@ -0,0 +1,721 @@
+// RUN: %clang_cc1 -x c++ -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s
+
+const char *l255 = "\xff";
+const char *l254 = "\xfe";
+const char *l253 = "\xfd";
+const char *l252 = "\xfc";
+const char *l251 = "\xfb";
+const char *l250 = "\xfa";
+const char *l249 = "\xf9";
+const char *l248 = "\xf8";
+const char *l247 = "\xf7";
+const char *l246 = "\xf6";
+const char *l245 = "\xf5";
+const char *l244 = "\xf4";
+const char *l243 = "\xf3";
+const char *l242 = "\xf2";
+const char *l241 = "\xf1";
+const char *l240 = "\xf0";
+const char *l239 = "\xef";
+const char *l238 = "\xee";
+const char *l237 = "\xed";
+const char *l236 = "\xec";
+const char *l235 = "\xeb";
+const char *l234 = "\xea";
+const char *l233 = "\xe9";
+const char *l232 = "\xe8";
+const char *l231 = "\xe7";
+const char *l230 = "\xe6";
+const char *l229 = "\xe5";
+const char *l228 = "\xe4";
+const char *l227 = "\xe3";
+const char *l226 = "\xe2";
+const char *l225 = "\xe1";
+const char *l224 = "\xe0";
+const char *l223 = "\xdf";
+const char *l222 = "\xde";
+const char *l221 = "\xdd";
+const char *l220 = "\xdc";
+const char *l219 = "\xdb";
+const char *l218 = "\xda";
+const char *l217 = "\xd9";
+const char *l216 = "\xd8";
+const char *l215 = "\xd7";
+const char *l214 = "\xd6";
+const char *l213 = "\xd5";
+const char *l212 = "\xd4";
+const char *l211 = "\xd3";
+const char *l210 = "\xd2";
+const char *l209 = "\xd1";
+const char *l208 = "\xd0";
+const char *l207 = "\xcf";
+const char *l206 = "\xce";
+const char *l205 = "\xcd";
+const char *l204 = "\xcc";
+const char *l203 = "\xcb";
+const char *l202 = "\xca";
+const char *l201 = "\xc9";
+const char *l200 = "\xc8";
+const char *l199 = "\xc7";
+const char *l198 = "\xc6";
+const char *l197 = "\xc5";
+const char *l196 = "\xc4";
+const char *l195 = "\xc3";
+const char *l194 = "\xc2";
+const char *l193 = "\xc1";
+const char *l192 = "\xc0";
+const char *l191 = "\xbf";
+const char *l190 = "\xbe";
+const char *l189 = "\xbd";
+const char *l188 = "\xbc";
+const char *l187 = "\xbb";
+const char *l186 = "\xba";
+const char *l185 = "\xb9";
+const char *l184 = "\xb8";
+const char *l183 = "\xb7";
+const char *l182 = "\xb6";
+const char *l181 = "\xb5";
+const char *l180 = "\xb4";
+const char *l179 = "\xb3";
+const char *l178 = "\xb2";
+const char *l177 = "\xb1";
+const char *l176 = "\xb0";
+const char *l175 = "\xaf";
+const char *l174 = "\xae";
+const char *l173 = "\xad";
+const char *l172 = "\xac";
+const char *l171 = "\xab";
+const char *l170 = "\xaa";
+const char *l169 = "\xa9";
+const char *l168 = "\xa8";
+const char *l167 = "\xa7";
+const char *l166 = "\xa6";
+const char *l165 = "\xa5";
+const char *l164 = "\xa4";
+const char *l163 = "\xa3";
+const char *l162 = "\xa2";
+const char *l161 = "\xa1";
+const char *l160 = "\xa0";
+const char *l159 = "\x9f";
+const char *l158 = "\x9e";
+const char *l157 = "\x9d";
+const char *l156 = "\x9c";
+const char *l155 = "\x9b";
+const char *l154 = "\x9a";
+const char *l153 = "\x99";
+const char *l152 = "\x98";
+const char *l151 = "\x97";
+const char *l150 = "\x96";
+const char *l149 = "\x95";
+const char *l148 = "\x94";
+const char *l147 = "\x93";
+const char *l146 = "\x92";
+const char *l145 = "\x91";
+const char *l144 = "\x90";
+const char *l143 = "\x8f";
+const char *l142 = "\x8e";
+const char *l141 = "\x8d";
+const char *l140 = "\x8c";
+const char *l139 = "\x8b";
+const char *l138 = "\x8a";
+const char *l137 = "\x89";
+const char *l136 = "\x88";
+const char *l135 = "\x87";
+const char *l134 = "\x86";
+const char *l133 = "\x85";
+const char *l132 = "\x84";
+const char *l131 = "\x83";
+const char *l130 = "\x82";
+const char *l129 = "\x81";
+const char *l128 = "\x80";
+const char *l127 = "\x7f";
+const char *l126 = "\x7e";
+const char *l125 = "\x7d";
+const char *l124 = "\x7c";
+const char *l123 = "\x7b";
+const char *l122 = "\x7a";
+const char *l121 = "\x79";
+const char *l120 = "\x78";
+const char *l119 = "\x77";
+const char *l118 = "\x76";
+const char *l117 = "\x75";
+const char *l116 = "\x74";
+const char *l115 = "\x73";
+const char *l114 = "\x72";
+const char *l113 = "\x71";
+const char *l112 = "\x70";
+const char *l111 = "\x6f";
+const char *l110 = "\x6e";
+const char *l109 = "\x6d";
+const char *l108 = "\x6c";
+const char *l107 = "\x6b";
+const char *l106 = "\x6a";
+const char *l105 = "\x69";
+const char *l104 = "\x68";
+const char *l103 = "\x67";
+const char *l102 = "\x66";
+const char *l101 = "\x65";
+const char *l100 = "\x64";
+const char *l99 = "\x63";
+const char *l98 = "\x62";
+const char *l97 = "\x61";
+const char *l96 = "\x60";
+const char *l95 = "\x5f";
+const char *l94 = "\x5e";
+const char *l93 = "\x5d";
+const char *l92 = "\x5c";
+const char *l91 = "\x5b";
+const char *l90 = "\x5a";
+const char *l89 = "\x59";
+const char *l88 = "\x58";
+const char *l87 = "\x57";
+const char *l86 = "\x56";
+const char *l85 = "\x55";
+const char *l84 = "\x54";
+const char *l83 = "\x53";
+const char *l82 = "\x52";
+const char *l81 = "\x51";
+const char *l80 = "\x50";
+const char *l79 = "\x4f";
+const char *l78 = "\x4e";
+const char *l77 = "\x4d";
+const char *l76 = "\x4c";
+const char *l75 = "\x4b";
+const char *l74 = "\x4a";
+const char *l73 = "\x49";
+const char *l72 = "\x48";
+const char *l71 = "\x47";
+const char *l70 = "\x46";
+const char *l69 = "\x45";
+const char *l68 = "\x44";
+const char *l67 = "\x43";
+const char *l66 = "\x42";
+const char *l65 = "\x41";
+const char *l64 = "\x40";
+const char *l63 = "\x3f";
+const char *l62 = "\x3e";
+const char *l61 = "\x3d";
+const char *l60 = "\x3c";
+const char *l59 = "\x3b";
+const char *l58 = "\x3a";
+const char *l57 = "\x39";
+const char *l56 = "\x38";
+const char *l55 = "\x37";
+const char *l54 = "\x36";
+const char *l53 = "\x35";
+const char *l52 = "\x34";
+const char *l51 = "\x33";
+const char *l50 = "\x32";
+const char *l49 = "\x31";
+const char *l48 = "\x30";
+const char *l47 = "\x2f";
+const char *l46 = "\x2e";
+const char *l45 = "\x2d";
+const char *l44 = "\x2c";
+const char *l43 = "\x2b";
+const char *l42 = "\x2a";
+const char *l41 = "\x29";
+const char *l40 = "\x28";
+const char *l39 = "\x27";
+const char *l38 = "\x26";
+const char *l37 = "\x25";
+const char *l36 = "\x24";
+const char *l35 = "\x23";
+const char *l34 = "\x22";
+const char *l33 = "\x21";
+const char *l32 = "\x20";
+const char *l31 = "\x1f";
+const char *l30 = "\x1e";
+const char *l29 = "\x1d";
+const char *l28 = "\x1c";
+const char *l27 = "\x1b";
+const char *l26 = "\x1a";
+const char *l25 = "\x19";
+const char *l24 = "\x18";
+const char *l23 = "\x17";
+const char *l22 = "\x16";
+const char *l21 = "\x15";
+const char *l20 = "\x14";
+const char *l19 = "\x13";
+const char *l18 = "\x12";
+const char *l17 = "\x11";
+const char *l16 = "\x10";
+const char *l15 = "\xf";
+const char *l14 = "\xe";
+const char *l13 = "\xd";
+const char *l12 = "\xc";
+const char *l11 = "\xb";
+const char *l10 = "\xa";
+const char *l9 = "\x9";
+const char *l8 = "\x8";
+const char *l7 = "\x7";
+const char *l6 = "\x6";
+const char *l5 = "\x5";
+const char *l4 = "\x4";
+const char *l3 = "\x3";
+const char *l2 = "\x2";
+const char *l1 = "\x1";
+const char *l0 = "\x0";
+
+// CHECK: @"\01??_C@_01CNACBAHC@?$PP?$AA@"
+// CHECK: @"\01??_C@_01DEBJCBDD@?$PO?$AA@"
+// CHECK: @"\01??_C@_01BPDEHCPA@?$PN?$AA@"
+// CHECK: @"\01??_C@_01GCPEDLB@?$PM?$AA@"
+// CHECK: @"\01??_C@_01EJGONFHG@?$PL?$AA@"
+// CHECK: @"\01??_C@_01FAHFOEDH@?z?$AA@"
+// CHECK: @"\01??_C@_01HLFILHPE@?y?$AA@"
+// CHECK: @"\01??_C@_01GCEDIGLF@?x?$AA@"
+// CHECK: @"\01??_C@_01OFNLJKHK@?w?$AA@"
+// CHECK: @"\01??_C@_01PMMAKLDL@?v?$AA@"
+// CHECK: @"\01??_C@_01NHONPIPI@?u?$AA@"
+// CHECK: @"\01??_C@_01MOPGMJLJ@?t?$AA@"
+// CHECK: @"\01??_C@_01IBLHFPHO@?s?$AA@"
+// CHECK: @"\01??_C@_01JIKMGODP@?r?$AA@"
+// CHECK: @"\01??_C@_01LDIBDNPM@?q?$AA@"
+// CHECK: @"\01??_C@_01KKJKAMLN@?p?$AA@"
+// CHECK: @"\01??_C@_01GHMAACCD@?o?$AA@"
+// CHECK: @"\01??_C@_01HONLDDGC@?n?$AA@"
+// CHECK: @"\01??_C@_01FFPGGAKB@?m?$AA@"
+// CHECK: @"\01??_C@_01EMONFBOA@?l?$AA@"
+// CHECK: @"\01??_C@_01DKMMHCH@?k?$AA@"
+// CHECK: @"\01??_C@_01BKLHPGGG@?j?$AA@"
+// CHECK: @"\01??_C@_01DBJKKFKF@?i?$AA@"
+// CHECK: @"\01??_C@_01CIIBJEOE@?h?$AA@"
+// CHECK: @"\01??_C@_01KPBJIICL@?g?$AA@"
+// CHECK: @"\01??_C@_01LGACLJGK@?f?$AA@"
+// CHECK: @"\01??_C@_01JNCPOKKJ@?e?$AA@"
+// CHECK: @"\01??_C@_01IEDENLOI@?d?$AA@"
+// CHECK: @"\01??_C@_01MLHFENCP@?c?$AA@"
+// CHECK: @"\01??_C@_01NCGOHMGO@?b?$AA@"
+// CHECK: @"\01??_C@_01PJEDCPKN@?a?$AA@"
+// CHECK: @"\01??_C@_01OAFIBOOM@?$OA?$AA@"
+// CHECK: @"\01??_C@_01LIIGDENA@?$NP?$AA@"
+// CHECK: @"\01??_C@_01KBJNAFJB@?$NO?$AA@"
+// CHECK: @"\01??_C@_01IKLAFGFC@?$NN?$AA@"
+// CHECK: @"\01??_C@_01JDKLGHBD@?$NM?$AA@"
+// CHECK: @"\01??_C@_01NMOKPBNE@?$NL?$AA@"
+// CHECK: @"\01??_C@_01MFPBMAJF@?Z?$AA@"
+// CHECK: @"\01??_C@_01OONMJDFG@?Y?$AA@"
+// CHECK: @"\01??_C@_01PHMHKCBH@?X?$AA@"
+// CHECK: @"\01??_C@_01HAFPLONI@?W?$AA@"
+// CHECK: @"\01??_C@_01GJEEIPJJ@?V?$AA@"
+// CHECK: @"\01??_C@_01ECGJNMFK@?U?$AA@"
+// CHECK: @"\01??_C@_01FLHCONBL@?T?$AA@"
+// CHECK: @"\01??_C@_01BEDDHLNM@?S?$AA@"
+// CHECK: @"\01??_C@_01NCIEKJN@?R?$AA@"
+// CHECK: @"\01??_C@_01CGAFBJFO@?Q?$AA@"
+// CHECK: @"\01??_C@_01DPBOCIBP@?P?$AA@"
+// CHECK: @"\01??_C@_01PCEECGIB@?O?$AA@"
+// CHECK: @"\01??_C@_01OLFPBHMA@?N?$AA@"
+// CHECK: @"\01??_C@_01MAHCEEAD@?M?$AA@"
+// CHECK: @"\01??_C@_01NJGJHFEC@?L?$AA@"
+// CHECK: @"\01??_C@_01JGCIODIF@?K?$AA@"
+// CHECK: @"\01??_C@_01IPDDNCME@?J?$AA@"
+// CHECK: @"\01??_C@_01KEBOIBAH@?I?$AA@"
+// CHECK: @"\01??_C@_01LNAFLAEG@?H?$AA@"
+// CHECK: @"\01??_C@_01DKJNKMIJ@?G?$AA@"
+// CHECK: @"\01??_C@_01CDIGJNMI@?F?$AA@"
+// CHECK: @"\01??_C@_01IKLMOAL@?E?$AA@"
+// CHECK: @"\01??_C@_01BBLAPPEK@?D?$AA@"
+// CHECK: @"\01??_C@_01FOPBGJIN@?C?$AA@"
+// CHECK: @"\01??_C@_01EHOKFIMM@?B?$AA@"
+// CHECK: @"\01??_C@_01GMMHALAP@?A?$AA@"
+// CHECK: @"\01??_C@_01HFNMDKEO@?$MA?$AA@"
+// CHECK: @"\01??_C@_01NNHLFPHH@?$LP?$AA@"
+// CHECK: @"\01??_C@_01MEGAGODG@?$LO?$AA@"
+// CHECK: @"\01??_C@_01OPENDNPF@?$LN?$AA@"
+// CHECK: @"\01??_C@_01PGFGAMLE@?$LM?$AA@"
+// CHECK: @"\01??_C@_01LJBHJKHD@?$LL?$AA@"
+// CHECK: @"\01??_C@_01KAAMKLDC@?$LK?$AA@"
+// CHECK: @"\01??_C@_01ILCBPIPB@?$LJ?$AA@"
+// CHECK: @"\01??_C@_01JCDKMJLA@?$LI?$AA@"
+// CHECK: @"\01??_C@_01BFKCNFHP@?$LH?$AA@"
+// CHECK: @"\01??_C@_01MLJOEDO@?$LG?$AA@"
+// CHECK: @"\01??_C@_01CHJELHPN@?$LF?$AA@"
+// CHECK: @"\01??_C@_01DOIPIGLM@?$LE?$AA@"
+// CHECK: @"\01??_C@_01HBMOBAHL@?$LD?$AA@"
+// CHECK: @"\01??_C@_01GINFCBDK@?$LC?$AA@"
+// CHECK: @"\01??_C@_01EDPIHCPJ@?$LB?$AA@"
+// CHECK: @"\01??_C@_01FKODEDLI@?$LA?$AA@"
+// CHECK: @"\01??_C@_01JHLJENCG@?$KP?$AA@"
+// CHECK: @"\01??_C@_01IOKCHMGH@?$KO?$AA@"
+// CHECK: @"\01??_C@_01KFIPCPKE@?$KN?$AA@"
+// CHECK: @"\01??_C@_01LMJEBOOF@?$KM?$AA@"
+// CHECK: @"\01??_C@_01PDNFIICC@?$KL?$AA@"
+// CHECK: @"\01??_C@_01OKMOLJGD@?$KK?$AA@"
+// CHECK: @"\01??_C@_01MBODOKKA@?$KJ?$AA@"
+// CHECK: @"\01??_C@_01NIPINLOB@?$KI?$AA@"
+// CHECK: @"\01??_C@_01FPGAMHCO@?$KH?$AA@"
+// CHECK: @"\01??_C@_01EGHLPGGP@?$KG?$AA@"
+// CHECK: @"\01??_C@_01GNFGKFKM@?$KF?$AA@"
+// CHECK: @"\01??_C@_01HEENJEON@?$KE?$AA@"
+// CHECK: @"\01??_C@_01DLAMACCK@?$KD?$AA@"
+// CHECK: @"\01??_C@_01CCBHDDGL@?$KC?$AA@"
+// CHECK: @"\01??_C@_01JDKGAKI@?$KB?$AA@"
+// CHECK: @"\01??_C@_01BACBFBOJ@?$KA?$AA@"
+// CHECK: @"\01??_C@_01EIPPHLNF@?$JP?$AA@"
+// CHECK: @"\01??_C@_01FBOEEKJE@?$JO?$AA@"
+// CHECK: @"\01??_C@_01HKMJBJFH@?$JN?$AA@"
+// CHECK: @"\01??_C@_01GDNCCIBG@?$JM?$AA@"
+// CHECK: @"\01??_C@_01CMJDLONB@?$JL?$AA@"
+// CHECK: @"\01??_C@_01DFIIIPJA@?$JK?$AA@"
+// CHECK: @"\01??_C@_01BOKFNMFD@?$JJ?$AA@"
+// CHECK: @"\01??_C@_01HLOONBC@?$JI?$AA@"
+// CHECK: @"\01??_C@_01IACGPBNN@?$JH?$AA@"
+// CHECK: @"\01??_C@_01JJDNMAJM@?$JG?$AA@"
+// CHECK: @"\01??_C@_01LCBAJDFP@?$JF?$AA@"
+// CHECK: @"\01??_C@_01KLALKCBO@?$JE?$AA@"
+// CHECK: @"\01??_C@_01OEEKDENJ@?$JD?$AA@"
+// CHECK: @"\01??_C@_01PNFBAFJI@?$JC?$AA@"
+// CHECK: @"\01??_C@_01NGHMFGFL@?$JB?$AA@"
+// CHECK: @"\01??_C@_01MPGHGHBK@?$JA?$AA@"
+// CHECK: @"\01??_C@_01CDNGJIE@?$IP?$AA@"
+// CHECK: @"\01??_C@_01BLCGFIMF@?$IO?$AA@"
+// CHECK: @"\01??_C@_01DAALALAG@?$IN?$AA@"
+// CHECK: @"\01??_C@_01CJBADKEH@?$IM?$AA@"
+// CHECK: @"\01??_C@_01GGFBKMIA@?$IL?$AA@"
+// CHECK: @"\01??_C@_01HPEKJNMB@?$IK?$AA@"
+// CHECK: @"\01??_C@_01FEGHMOAC@?$IJ?$AA@"
+// CHECK: @"\01??_C@_01ENHMPPED@?$II?$AA@"
+// CHECK: @"\01??_C@_01MKOEODIM@?$IH?$AA@"
+// CHECK: @"\01??_C@_01NDPPNCMN@?$IG?$AA@"
+// CHECK: @"\01??_C@_01PINCIBAO@?$IF?$AA@"
+// CHECK: @"\01??_C@_01OBMJLAEP@?$IE?$AA@"
+// CHECK: @"\01??_C@_01KOIICGII@?$ID?$AA@"
+// CHECK: @"\01??_C@_01LHJDBHMJ@?$IC?$AA@"
+// CHECK: @"\01??_C@_01JMLOEEAK@?$IB?$AA@"
+// CHECK: @"\01??_C@_01IFKFHFEL@?$IA?$AA@"
+// CHECK: @"\01??_C@_01BGIBIIDJ@?$HP?$AA@"
+// CHECK: @"\01??_C@_01PJKLJHI@?$HO?$AA@"
+// CHECK: @"\01??_C@_01CELHOKLL@?$HN?$AA@"
+// CHECK: @"\01??_C@_01DNKMNLPK@?$HM?$AA@"
+// CHECK: @"\01??_C@_01HCONENDN@?$HL?$AA@"
+// CHECK: @"\01??_C@_01GLPGHMHM@z?$AA@"
+// CHECK: @"\01??_C@_01EANLCPLP@y?$AA@"
+// CHECK: @"\01??_C@_01FJMABOPO@x?$AA@"
+// CHECK: @"\01??_C@_01NOFIACDB@w?$AA@"
+// CHECK: @"\01??_C@_01MHEDDDHA@v?$AA@"
+// CHECK: @"\01??_C@_01OMGOGALD@u?$AA@"
+// CHECK: @"\01??_C@_01PFHFFBPC@t?$AA@"
+// CHECK: @"\01??_C@_01LKDEMHDF@s?$AA@"
+// CHECK: @"\01??_C@_01KDCPPGHE@r?$AA@"
+// CHECK: @"\01??_C@_01IIACKFLH@q?$AA@"
+// CHECK: @"\01??_C@_01JBBJJEPG@p?$AA@"
+// CHECK: @"\01??_C@_01FMEDJKGI@o?$AA@"
+// CHECK: @"\01??_C@_01EFFIKLCJ@n?$AA@"
+// CHECK: @"\01??_C@_01GOHFPIOK@m?$AA@"
+// CHECK: @"\01??_C@_01HHGOMJKL@l?$AA@"
+// CHECK: @"\01??_C@_01DICPFPGM@k?$AA@"
+// CHECK: @"\01??_C@_01CBDEGOCN@j?$AA@"
+// CHECK: @"\01??_C@_01KBJDNOO@i?$AA@"
+// CHECK: @"\01??_C@_01BDACAMKP@h?$AA@"
+// CHECK: @"\01??_C@_01JEJKBAGA@g?$AA@"
+// CHECK: @"\01??_C@_01INIBCBCB@f?$AA@"
+// CHECK: @"\01??_C@_01KGKMHCOC@e?$AA@"
+// CHECK: @"\01??_C@_01LPLHEDKD@d?$AA@"
+// CHECK: @"\01??_C@_01PAPGNFGE@c?$AA@"
+// CHECK: @"\01??_C@_01OJONOECF@b?$AA@"
+// CHECK: @"\01??_C@_01MCMALHOG@a?$AA@"
+// CHECK: @"\01??_C@_01NLNLIGKH@?$GA?$AA@"
+// CHECK: @"\01??_C@_01IDAFKMJL@_?$AA@"
+// CHECK: @"\01??_C@_01JKBOJNNK@?$FO?$AA@"
+// CHECK: @"\01??_C@_01LBDDMOBJ@?$FN?$AA@"
+// CHECK: @"\01??_C@_01KICIPPFI@?2?$AA@"
+// CHECK: @"\01??_C@_01OHGJGJJP@?$FL?$AA@"
+// CHECK: @"\01??_C@_01POHCFINO@Z?$AA@"
+// CHECK: @"\01??_C@_01NFFPALBN@Y?$AA@"
+// CHECK: @"\01??_C@_01MMEEDKFM@X?$AA@"
+// CHECK: @"\01??_C@_01ELNMCGJD@W?$AA@"
+// CHECK: @"\01??_C@_01FCMHBHNC@V?$AA@"
+// CHECK: @"\01??_C@_01HJOKEEBB@U?$AA@"
+// CHECK: @"\01??_C@_01GAPBHFFA@T?$AA@"
+// CHECK: @"\01??_C@_01CPLAODJH@S?$AA@"
+// CHECK: @"\01??_C@_01DGKLNCNG@R?$AA@"
+// CHECK: @"\01??_C@_01BNIGIBBF@Q?$AA@"
+// CHECK: @"\01??_C@_01EJNLAFE@P?$AA@"
+// CHECK: @"\01??_C@_01MJMHLOMK@O?$AA@"
+// CHECK: @"\01??_C@_01NANMIPIL@N?$AA@"
+// CHECK: @"\01??_C@_01PLPBNMEI@M?$AA@"
+// CHECK: @"\01??_C@_01OCOKONAJ@L?$AA@"
+// CHECK: @"\01??_C@_01KNKLHLMO@K?$AA@"
+// CHECK: @"\01??_C@_01LELAEKIP@J?$AA@"
+// CHECK: @"\01??_C@_01JPJNBJEM@I?$AA@"
+// CHECK: @"\01??_C@_01IGIGCIAN@H?$AA@"
+// CHECK: @"\01??_C@_01BBODEMC@G?$AA@"
+// CHECK: @"\01??_C@_01BIAFAFID@F?$AA@"
+// CHECK: @"\01??_C@_01DDCIFGEA@E?$AA@"
+// CHECK: @"\01??_C@_01CKDDGHAB@D?$AA@"
+// CHECK: @"\01??_C@_01GFHCPBMG@C?$AA@"
+// CHECK: @"\01??_C@_01HMGJMAIH@B?$AA@"
+// CHECK: @"\01??_C@_01FHEEJDEE@A?$AA@"
+// CHECK: @"\01??_C@_01EOFPKCAF@?$EA?$AA@"
+// CHECK: @"\01??_C@_01OGPIMHDM@?$DP?$AA@"
+// CHECK: @"\01??_C@_01PPODPGHN@?$DO?$AA@"
+// CHECK: @"\01??_C@_01NEMOKFLO@?$DN?$AA@"
+// CHECK: @"\01??_C@_01MNNFJEPP@?$DM?$AA@"
+// CHECK: @"\01??_C@_01ICJEACDI@?$DL?$AA@"
+// CHECK: @"\01??_C@_01JLIPDDHJ@?3?$AA@"
+// CHECK: @"\01??_C@_01LAKCGALK@9?$AA@"
+// CHECK: @"\01??_C@_01KJLJFBPL@8?$AA@"
+// CHECK: @"\01??_C@_01COCBENDE@7?$AA@"
+// CHECK: @"\01??_C@_01DHDKHMHF@6?$AA@"
+// CHECK: @"\01??_C@_01BMBHCPLG@5?$AA@"
+// CHECK: @"\01??_C@_01FAMBOPH@4?$AA@"
+// CHECK: @"\01??_C@_01EKENIIDA@3?$AA@"
+// CHECK: @"\01??_C@_01FDFGLJHB@2?$AA@"
+// CHECK: @"\01??_C@_01HIHLOKLC@1?$AA@"
+// CHECK: @"\01??_C@_01GBGANLPD@0?$AA@"
+// CHECK: @"\01??_C@_01KMDKNFGN@?1?$AA@"
+// CHECK: @"\01??_C@_01LFCBOECM@?4?$AA@"
+// CHECK: @"\01??_C@_01JOAMLHOP@?9?$AA@"
+// CHECK: @"\01??_C@_01IHBHIGKO@?0?$AA@"
+// CHECK: @"\01??_C@_01MIFGBAGJ@?$CL?$AA@"
+// CHECK: @"\01??_C@_01NBENCBCI@?$CK?$AA@"
+// CHECK: @"\01??_C@_01PKGAHCOL@?$CJ?$AA@"
+// CHECK: @"\01??_C@_01ODHLEDKK@?$CI?$AA@"
+// CHECK: @"\01??_C@_01GEODFPGF@?8?$AA@"
+// CHECK: @"\01??_C@_01HNPIGOCE@?$CG?$AA@"
+// CHECK: @"\01??_C@_01FGNFDNOH@?$CF?$AA@"
+// CHECK: @"\01??_C@_01EPMOAMKG@$?$AA@"
+// CHECK: @"\01??_C@_01IPJKGB@?$CD?$AA@"
+// CHECK: @"\01??_C@_01BJJEKLCA@?$CC?$AA@"
+// CHECK: @"\01??_C@_01DCLJPIOD@?$CB?$AA@"
+// CHECK: @"\01??_C@_01CLKCMJKC@?5?$AA@"
+// CHECK: @"\01??_C@_01HDHMODJO@?$BP?$AA@"
+// CHECK: @"\01??_C@_01GKGHNCNP@?$BO?$AA@"
+// CHECK: @"\01??_C@_01EBEKIBBM@?$BN?$AA@"
+// CHECK: @"\01??_C@_01FIFBLAFN@?$BM?$AA@"
+// CHECK: @"\01??_C@_01BHBACGJK@?$BL?$AA@"
+// CHECK: @"\01??_C@_01OALBHNL@?$BK?$AA@"
+// CHECK: @"\01??_C@_01CFCGEEBI@?$BJ?$AA@"
+// CHECK: @"\01??_C@_01DMDNHFFJ@?$BI?$AA@"
+// CHECK: @"\01??_C@_01LLKFGJJG@?$BH?$AA@"
+// CHECK: @"\01??_C@_01KCLOFINH@?$BG?$AA@"
+// CHECK: @"\01??_C@_01IJJDALBE@?$BF?$AA@"
+// CHECK: @"\01??_C@_01JAIIDKFF@?$BE?$AA@"
+// CHECK: @"\01??_C@_01NPMJKMJC@?$BD?$AA@"
+// CHECK: @"\01??_C@_01MGNCJNND@?$BC?$AA@"
+// CHECK: @"\01??_C@_01ONPPMOBA@?$BB?$AA@"
+// CHECK: @"\01??_C@_01PEOEPPFB@?$BA?$AA@"
+// CHECK: @"\01??_C@_01DJLOPBMP@?$AP?$AA@"
+// CHECK: @"\01??_C@_01CAKFMAIO@?$AO?$AA@"
+// CHECK: @"\01??_C@_01LIIJDEN@?$AN?$AA@"
+// CHECK: @"\01??_C@_01BCJDKCAM@?$AM?$AA@"
+// CHECK: @"\01??_C@_01FNNCDEML@?$AL?$AA@"
+// CHECK: @"\01??_C@_01EEMJAFIK@?6?$AA@"
+// CHECK: @"\01??_C@_01GPOEFGEJ@?7?$AA@"
+// CHECK: @"\01??_C@_01HGPPGHAI@?$AI?$AA@"
+// CHECK: @"\01??_C@_01PBGHHLMH@?$AH?$AA@"
+// CHECK: @"\01??_C@_01OIHMEKIG@?$AG?$AA@"
+// CHECK: @"\01??_C@_01MDFBBJEF@?$AF?$AA@"
+// CHECK: @"\01??_C@_01NKEKCIAE@?$AE?$AA@"
+// CHECK: @"\01??_C@_01JFALLOMD@?$AD?$AA@"
+// CHECK: @"\01??_C@_01IMBAIPIC@?$AC?$AA@"
+// CHECK: @"\01??_C@_01KHDNNMEB@?$AB?$AA@"
+// CHECK: @"\01??_C@_01LOCGONAA@?$AA?$AA@"
+
+const wchar_t *wl9 = L"\t";
+const wchar_t *wl10 = L"\n";
+const wchar_t *wl11 = L"\v";
+const wchar_t *wl32 = L" ";
+const wchar_t *wl33 = L"!";
+const wchar_t *wl34 = L"\"";
+const wchar_t *wl35 = L"#";
+const wchar_t *wl36 = L"$";
+const wchar_t *wl37 = L"%";
+const wchar_t *wl38 = L"&";
+const wchar_t *wl39 = L"'";
+const wchar_t *wl40 = L"(";
+const wchar_t *wl41 = L")";
+const wchar_t *wl42 = L"*";
+const wchar_t *wl43 = L"+";
+const wchar_t *wl44 = L",";
+const wchar_t *wl45 = L"-";
+const wchar_t *wl46 = L".";
+const wchar_t *wl47 = L"/";
+const wchar_t *wl48 = L"0";
+const wchar_t *wl49 = L"1";
+const wchar_t *wl50 = L"2";
+const wchar_t *wl51 = L"3";
+const wchar_t *wl52 = L"4";
+const wchar_t *wl53 = L"5";
+const wchar_t *wl54 = L"6";
+const wchar_t *wl55 = L"7";
+const wchar_t *wl56 = L"8";
+const wchar_t *wl57 = L"9";
+const wchar_t *wl58 = L":";
+const wchar_t *wl59 = L";";
+const wchar_t *wl60 = L"<";
+const wchar_t *wl61 = L"=";
+const wchar_t *wl62 = L">";
+const wchar_t *wl63 = L"?";
+const wchar_t *wl64 = L"@";
+const wchar_t *wl65 = L"A";
+const wchar_t *wl66 = L"B";
+const wchar_t *wl67 = L"C";
+const wchar_t *wl68 = L"D";
+const wchar_t *wl69 = L"E";
+const wchar_t *wl70 = L"F";
+const wchar_t *wl71 = L"G";
+const wchar_t *wl72 = L"H";
+const wchar_t *wl73 = L"I";
+const wchar_t *wl74 = L"J";
+const wchar_t *wl75 = L"K";
+const wchar_t *wl76 = L"L";
+const wchar_t *wl77 = L"M";
+const wchar_t *wl78 = L"N";
+const wchar_t *wl79 = L"O";
+const wchar_t *wl80 = L"P";
+const wchar_t *wl81 = L"Q";
+const wchar_t *wl82 = L"R";
+const wchar_t *wl83 = L"S";
+const wchar_t *wl84 = L"T";
+const wchar_t *wl85 = L"U";
+const wchar_t *wl86 = L"V";
+const wchar_t *wl87 = L"W";
+const wchar_t *wl88 = L"X";
+const wchar_t *wl89 = L"Y";
+const wchar_t *wl90 = L"Z";
+const wchar_t *wl91 = L"[";
+const wchar_t *wl92 = L"\\";
+const wchar_t *wl93 = L"]";
+const wchar_t *wl94 = L"^";
+const wchar_t *wl95 = L"_";
+const wchar_t *wl96 = L"`";
+const wchar_t *wl97 = L"a";
+const wchar_t *wl98 = L"b";
+const wchar_t *wl99 = L"c";
+const wchar_t *wl100 = L"d";
+const wchar_t *wl101 = L"e";
+const wchar_t *wl102 = L"f";
+const wchar_t *wl103 = L"g";
+const wchar_t *wl104 = L"h";
+const wchar_t *wl105 = L"i";
+const wchar_t *wl106 = L"j";
+const wchar_t *wl107 = L"k";
+const wchar_t *wl108 = L"l";
+const wchar_t *wl109 = L"m";
+const wchar_t *wl110 = L"n";
+const wchar_t *wl111 = L"o";
+const wchar_t *wl112 = L"p";
+const wchar_t *wl113 = L"q";
+const wchar_t *wl114 = L"r";
+const wchar_t *wl115 = L"s";
+const wchar_t *wl116 = L"t";
+const wchar_t *wl117 = L"u";
+const wchar_t *wl118 = L"v";
+const wchar_t *wl119 = L"w";
+const wchar_t *wl120 = L"x";
+const wchar_t *wl121 = L"y";
+const wchar_t *wl122 = L"z";
+const wchar_t *wl123 = L"{";
+const wchar_t *wl124 = L"|";
+const wchar_t *wl125 = L"}";
+const wchar_t *wl126 = L"~";
+
+// CHECK: @"\01??_C@_13KDLDGPGJ@?$AA?7?$AA?$AA@"
+// CHECK: @"\01??_C@_13LBAGMAIH@?$AA?6?$AA?$AA@"
+// CHECK: @"\01??_C@_13JLKKHOC@?$AA?$AL?$AA?$AA@"
+// CHECK: @"\01??_C@_13HOIJIPNN@?$AA?5?$AA?$AA@"
+// CHECK: @"\01??_C@_13MGDFOILI@?$AA?$CB?$AA?$AA@"
+// CHECK: @"\01??_C@_13NEIAEHFG@?$AA?$CC?$AA?$AA@"
+// CHECK: @"\01??_C@_13GMDMCADD@?$AA?$CD?$AA?$AA@"
+// CHECK: @"\01??_C@_13PBOLBIIK@?$AA$?$AA?$AA@"
+// CHECK: @"\01??_C@_13EJFHHPOP@?$AA?$CF?$AA?$AA@"
+// CHECK: @"\01??_C@_13FLOCNAAB@?$AA?$CG?$AA?$AA@"
+// CHECK: @"\01??_C@_13ODFOLHGE@?$AA?8?$AA?$AA@"
+// CHECK: @"\01??_C@_13LLDNKHDC@?$AA?$CI?$AA?$AA@"
+// CHECK: @"\01??_C@_13DIBMAFH@?$AA?$CJ?$AA?$AA@"
+// CHECK: @"\01??_C@_13BBDEGPLJ@?$AA?$CK?$AA?$AA@"
+// CHECK: @"\01??_C@_13KJIIAINM@?$AA?$CL?$AA?$AA@"
+// CHECK: @"\01??_C@_13DEFPDAGF@?$AA?0?$AA?$AA@"
+// CHECK: @"\01??_C@_13IMODFHAA@?$AA?9?$AA?$AA@"
+// CHECK: @"\01??_C@_13JOFGPIOO@?$AA?4?$AA?$AA@"
+// CHECK: @"\01??_C@_13CGOKJPIL@?$AA?1?$AA?$AA@"
+// CHECK: @"\01??_C@_13COJANIEC@?$AA0?$AA?$AA@"
+// CHECK: @"\01??_C@_13JGCMLPCH@?$AA1?$AA?$AA@"
+// CHECK: @"\01??_C@_13IEJJBAMJ@?$AA2?$AA?$AA@"
+// CHECK: @"\01??_C@_13DMCFHHKM@?$AA3?$AA?$AA@"
+// CHECK: @"\01??_C@_13KBPCEPBF@?$AA4?$AA?$AA@"
+// CHECK: @"\01??_C@_13BJEOCIHA@?$AA5?$AA?$AA@"
+// CHECK: @"\01??_C@_13LPLIHJO@?$AA6?$AA?$AA@"
+// CHECK: @"\01??_C@_13LDEHOAPL@?$AA7?$AA?$AA@"
+// CHECK: @"\01??_C@_13OLCEPAKN@?$AA8?$AA?$AA@"
+// CHECK: @"\01??_C@_13FDJIJHMI@?$AA9?$AA?$AA@"
+// CHECK: @"\01??_C@_13EBCNDICG@?$AA?3?$AA?$AA@"
+// CHECK: @"\01??_C@_13PJJBFPED@?$AA?$DL?$AA?$AA@"
+// CHECK: @"\01??_C@_13GEEGGHPK@?$AA?$DM?$AA?$AA@"
+// CHECK: @"\01??_C@_13NMPKAAJP@?$AA?$DN?$AA?$AA@"
+// CHECK: @"\01??_C@_13MOEPKPHB@?$AA?$DO?$AA?$AA@"
+// CHECK: @"\01??_C@_13HGPDMIBE@?$AA?$DP?$AA?$AA@"
+// CHECK: @"\01??_C@_13EFKPHINO@?$AA?$EA?$AA?$AA@"
+// CHECK: @"\01??_C@_13PNBDBPLL@?$AAA?$AA?$AA@"
+// CHECK: @"\01??_C@_13OPKGLAFF@?$AAB?$AA?$AA@"
+// CHECK: @"\01??_C@_13FHBKNHDA@?$AAC?$AA?$AA@"
+// CHECK: @"\01??_C@_13MKMNOPIJ@?$AAD?$AA?$AA@"
+// CHECK: @"\01??_C@_13HCHBIIOM@?$AAE?$AA?$AA@"
+// CHECK: @"\01??_C@_13GAMECHAC@?$AAF?$AA?$AA@"
+// CHECK: @"\01??_C@_13NIHIEAGH@?$AAG?$AA?$AA@"
+// CHECK: @"\01??_C@_13IABLFADB@?$AAH?$AA?$AA@"
+// CHECK: @"\01??_C@_13DIKHDHFE@?$AAI?$AA?$AA@"
+// CHECK: @"\01??_C@_13CKBCJILK@?$AAJ?$AA?$AA@"
+// CHECK: @"\01??_C@_13JCKOPPNP@?$AAK?$AA?$AA@"
+// CHECK: @"\01??_C@_13PHJMHGG@?$AAL?$AA?$AA@"
+// CHECK: @"\01??_C@_13LHMFKAAD@?$AAM?$AA?$AA@"
+// CHECK: @"\01??_C@_13KFHAAPON@?$AAN?$AA?$AA@"
+// CHECK: @"\01??_C@_13BNMMGIII@?$AAO?$AA?$AA@"
+// CHECK: @"\01??_C@_13BFLGCPEB@?$AAP?$AA?$AA@"
+// CHECK: @"\01??_C@_13KNAKEICE@?$AAQ?$AA?$AA@"
+// CHECK: @"\01??_C@_13LPLPOHMK@?$AAR?$AA?$AA@"
+// CHECK: @"\01??_C@_13HADIAKP@?$AAS?$AA?$AA@"
+// CHECK: @"\01??_C@_13JKNELIBG@?$AAT?$AA?$AA@"
+// CHECK: @"\01??_C@_13CCGINPHD@?$AAU?$AA?$AA@"
+// CHECK: @"\01??_C@_13DANNHAJN@?$AAV?$AA?$AA@"
+// CHECK: @"\01??_C@_13IIGBBHPI@?$AAW?$AA?$AA@"
+// CHECK: @"\01??_C@_13NAACAHKO@?$AAX?$AA?$AA@"
+// CHECK: @"\01??_C@_13GILOGAML@?$AAY?$AA?$AA@"
+// CHECK: @"\01??_C@_13HKALMPCF@?$AAZ?$AA?$AA@"
+// CHECK: @"\01??_C@_13MCLHKIEA@?$AA?$FL?$AA?$AA@"
+// CHECK: @"\01??_C@_13FPGAJAPJ@?$AA?2?$AA?$AA@"
+// CHECK: @"\01??_C@_13OHNMPHJM@?$AA?$FN?$AA?$AA@"
+// CHECK: @"\01??_C@_13PFGJFIHC@?$AA?$FO?$AA?$AA@"
+// CHECK: @"\01??_C@_13ENNFDPBH@?$AA_?$AA?$AA@"
+// CHECK: @"\01??_C@_13OFJNNHOA@?$AA?$GA?$AA?$AA@"
+// CHECK: @"\01??_C@_13FNCBLAIF@?$AAa?$AA?$AA@"
+// CHECK: @"\01??_C@_13EPJEBPGL@?$AAb?$AA?$AA@"
+// CHECK: @"\01??_C@_13PHCIHIAO@?$AAc?$AA?$AA@"
+// CHECK: @"\01??_C@_13GKPPEALH@?$AAd?$AA?$AA@"
+// CHECK: @"\01??_C@_13NCEDCHNC@?$AAe?$AA?$AA@"
+// CHECK: @"\01??_C@_13MAPGIIDM@?$AAf?$AA?$AA@"
+// CHECK: @"\01??_C@_13HIEKOPFJ@?$AAg?$AA?$AA@"
+// CHECK: @"\01??_C@_13CACJPPAP@?$AAh?$AA?$AA@"
+// CHECK: @"\01??_C@_13JIJFJIGK@?$AAi?$AA?$AA@"
+// CHECK: @"\01??_C@_13IKCADHIE@?$AAj?$AA?$AA@"
+// CHECK: @"\01??_C@_13DCJMFAOB@?$AAk?$AA?$AA@"
+// CHECK: @"\01??_C@_13KPELGIFI@?$AAl?$AA?$AA@"
+// CHECK: @"\01??_C@_13BHPHAPDN@?$AAm?$AA?$AA@"
+// CHECK: @"\01??_C@_13FECKAND@?$AAn?$AA?$AA@"
+// CHECK: @"\01??_C@_13LNPOMHLG@?$AAo?$AA?$AA@"
+// CHECK: @"\01??_C@_13LFIEIAHP@?$AAp?$AA?$AA@"
+// CHECK: @"\01??_C@_13NDIOHBK@?$AAq?$AA?$AA@"
+// CHECK: @"\01??_C@_13BPINEIPE@?$AAr?$AA?$AA@"
+// CHECK: @"\01??_C@_13KHDBCPJB@?$AAs?$AA?$AA@"
+// CHECK: @"\01??_C@_13DKOGBHCI@?$AAt?$AA?$AA@"
+// CHECK: @"\01??_C@_13ICFKHAEN@?$AAu?$AA?$AA@"
+// CHECK: @"\01??_C@_13JAOPNPKD@?$AAv?$AA?$AA@"
+// CHECK: @"\01??_C@_13CIFDLIMG@?$AAw?$AA?$AA@"
+// CHECK: @"\01??_C@_13HADAKIJA@?$AAx?$AA?$AA@"
+// CHECK: @"\01??_C@_13MIIMMPPF@?$AAy?$AA?$AA@"
+// CHECK: @"\01??_C@_13NKDJGABL@?$AAz?$AA?$AA@"
+// CHECK: @"\01??_C@_13GCIFAHHO@?$AA?$HL?$AA?$AA@"
+// CHECK: @"\01??_C@_13PPFCDPMH@?$AA?$HM?$AA?$AA@"
+// CHECK: @"\01??_C@_13EHOOFIKC@?$AA?$HN?$AA?$AA@"
+// CHECK: @"\01??_C@_13FFFLPHEM@?$AA?$HO?$AA?$AA@"
+
+const char *LongASCIIString = "012345678901234567890123456789ABCDEF";
+// CHECK: @"\01??_C@_0CF@LABBIIMO@012345678901234567890123456789AB@"
+const wchar_t *LongWideString = L"012345678901234567890123456789ABCDEF";
+// CHECK: @"\01??_C@_1EK@KFPEBLPK@?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AAA?$AAB@"
+const wchar_t *UnicodeLiteral = L"\ud7ff";
+// CHECK: @"\01??_C@_13IIHIAFKH@?W?$PP?$AA?$AA@"
diff --git a/test/CodeGenCXX/mangle-ms-template-callback.cpp b/test/CodeGenCXX/mangle-ms-template-callback.cpp
index 6878148..1a8f82f 100644
--- a/test/CodeGenCXX/mangle-ms-template-callback.cpp
+++ b/test/CodeGenCXX/mangle-ms-template-callback.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
template<typename Signature>
class C;
@@ -70,3 +70,20 @@
// CHECK: "\01??$bar@P_EAHH@Z@@YAXP_EAHH@Z@Z"
// FYI blocks are not present in MSVS, so we're free to choose the spec.
}
+
+template <void (*Fn)()> void WrapFnPtr() { Fn(); }
+template <void (&Fn)()> void WrapFnRef() { Fn(); }
+struct Thing {
+ static void VoidStaticMethod();
+};
+void VoidFn();
+void CallWrapper() {
+ WrapFnPtr<VoidFn>();
+ WrapFnRef<VoidFn>();
+ WrapFnPtr<Thing::VoidStaticMethod>();
+ WrapFnRef<Thing::VoidStaticMethod>();
+}
+// CHECK: call {{.*}} @"\01??$WrapFnPtr@$1?VoidFn@@YAXXZ@@YAXXZ"
+// CHECK: call {{.*}} @"\01??$WrapFnRef@$1?VoidFn@@YAXXZ@@YAXXZ"
+// CHECK: call {{.*}} @"\01??$WrapFnPtr@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ"
+// CHECK: call {{.*}} @"\01??$WrapFnRef@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ"
diff --git a/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp
new file mode 100644
index 0000000..803cac3
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp
@@ -0,0 +1,143 @@
+// RUN: %clang_cc1 -Wno-microsoft -fno-rtti -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+
+struct U;
+static_assert(sizeof(void (U::*)()) == 2 * sizeof(void*) + 2 * sizeof(int), "");
+
+struct A { int a; };
+struct B { int b; };
+struct I { union { struct { int a, b; }; }; };
+
+struct S { int a, b; void f(); virtual void g(); };
+struct M : A, B { int a, b; void f(); virtual void g(); };
+struct V : virtual A { int a, b; void f(); virtual void g(); };
+struct U { int a, b; void f(); virtual void g(); };
+
+struct C { virtual void f(); };
+struct D { virtual void g(); };
+struct O : C, D { virtual void g(); }; // override of non-primary
+
+// Test data member pointers.
+template <typename T, int T::*F>
+int ReadField(T &o) {
+ return F ? o.*F : 0;
+}
+
+// Redeclare some of the classes so that the implicit attribute goes on the most
+// recent redeclaration rather than the definition.
+struct V;
+
+void ReadFields() {
+ A a;
+ I i;
+ S s;
+ M m;
+ V v;
+ U u;
+ ReadField<S, &S::a>(s);
+ ReadField<M, &M::a>(m);
+ ReadField<V, &V::a>(v);
+ ReadField<U, &U::a>(u);
+ ReadField<S, &S::b>(s);
+ ReadField<M, &M::b>(m);
+ ReadField<V, &V::b>(v);
+ ReadField<U, &U::b>(u);
+ ReadField<S, nullptr>(s);
+ ReadField<M, nullptr>(m);
+ ReadField<V, nullptr>(v);
+ ReadField<U, nullptr>(u);
+
+ // Non-polymorphic null data memptr vs first field memptr.
+ ReadField<A, &A::a>(a);
+ ReadField<A, nullptr>(a);
+
+ // Indirect fields injected from anonymous unions and structs
+ ReadField<I, &I::a>(i);
+ ReadField<I, &I::b>(i);
+}
+
+// CHECK-LABEL: define {{.*}}ReadFields
+// CHECK: call {{.*}} @"\01??$ReadField@US@@$03@@YAHAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UM@@$0M@@@YAHAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UV@@$F7A@@@YAHAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UU@@$G3A@A@@@YAHAAUU@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@US@@$07@@YAHAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UM@@$0BA@@@YAHAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UV@@$FM@A@@@YAHAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UU@@$G7A@A@@@YAHAAUU@@@Z"
+
+// MSVC mangles null member pointers in function templates wrong, but it gets
+// them right in class templates.
+// CHECK: call {{.*}} @"\01??$ReadField@US@@$0A@@@YAHAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UM@@$0A@@@YAHAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UV@@$FA@?0@@YAHAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UU@@$GA@A@?0@@YAHAAUU@@@Z"
+
+// Non-polymorphic null data memptr vs first field memptr. MSVC mangles these
+// the same.
+// CHECK: call {{.*}} @"\01??$ReadField@UA@@$0A@@@YAHAAUA@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UA@@$0?0@@YAHAAUA@@@Z"
+
+// Indirect fields are handled as-if they were simply members of their enclosing
+// record.
+// CHECK: call {{.*}} @"\01??$ReadField@UI@@$0A@@@YAHAAUI@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UI@@$03@@YAHAAUI@@@Z"
+
+// Test member function pointers.
+template <typename T, void (T::*MFP)()>
+void CallMethod(T &o) {
+ (o.*MFP)();
+}
+
+void CallMethods() {
+ S s;
+ M m;
+ V v;
+ U u;
+ O o;
+
+ // Non-virtual methods.
+ CallMethod<S, &S::f>(s);
+ CallMethod<M, &M::f>(m);
+ CallMethod<V, &V::f>(v);
+ CallMethod<U, &U::f>(u);
+
+ // Virtual methods requiring thunk mangling.
+ CallMethod<S, &S::g>(s);
+ CallMethod<M, &M::g>(m);
+ CallMethod<V, &V::g>(v);
+ CallMethod<U, &U::g>(u);
+
+ // A member pointer for a non-primary vbase will have a non-zero this
+ // adjustment.
+ CallMethod<O, &O::g>(o);
+
+ // Null member pointers.
+ CallMethod<S, nullptr>(s);
+ CallMethod<M, nullptr>(m);
+ CallMethod<V, nullptr>(v);
+ CallMethod<U, nullptr>(u);
+}
+
+// CHECK-LABEL: define {{.*}}CallMethods
+// CHECK: call {{.*}} @"\01??$CallMethod@US@@$1?f@1@QAEXXZ@@YAXAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UM@@$H?f@1@QAEXXZA@@@YAXAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UV@@$I?f@1@QAEXXZA@A@@@YAXAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UU@@$J?f@1@QAEXXZA@A@A@@@YAXAAUU@@@Z"
+
+// PR17034: MSVC reuses the same thunk for every virtual g method because they
+// are all at vftable offset zero. They then mangle the name of the first thunk
+// created into the name of the template instantiation, which is definitely a
+// bug. We don't follow them here. Instead of ?_91@ backref below, they would
+// get ?_9S@@ in every instantiation after the first.
+
+// CHECK: call {{.*}} @"\01??$CallMethod@US@@$1??_91@$BA@AE@@YAXAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UM@@$H??_91@$BA@AEA@@@YAXAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UV@@$I??_91@$BA@AEA@A@@@YAXAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UU@@$J??_91@$BA@AEA@A@A@@@YAXAAUU@@@Z"
+
+// CHECK: call {{.*}} @"\01??$CallMethod@UO@@$H??_91@$BA@AE3@@YAXAAUO@@@Z"
+
+// CHECK: call {{.*}} @"\01??$CallMethod@US@@$0A@@@YAXAAUS@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UM@@$0A@@@YAXAAUM@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UV@@$0A@@@YAXAAUV@@@Z"
+// CHECK: call {{.*}} @"\01??$CallMethod@UU@@$0A@@@YAXAAUU@@@Z"
diff --git a/test/CodeGenCXX/mangle-ms-templates.cpp b/test/CodeGenCXX/mangle-ms-templates.cpp
index 514f573..24e4f4a 100644
--- a/test/CodeGenCXX/mangle-ms-templates.cpp
+++ b/test/CodeGenCXX/mangle-ms-templates.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
template<typename T>
class Class {
diff --git a/test/CodeGenCXX/mangle-ms-vector-types.cpp b/test/CodeGenCXX/mangle-ms-vector-types.cpp
index 64cb725..aca4929 100644
--- a/test/CodeGenCXX/mangle-ms-vector-types.cpp
+++ b/test/CodeGenCXX/mangle-ms-vector-types.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -ffreestanding -target-feature +avx -emit-llvm %s -o - -cxx-abi microsoft -triple=i686-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -ffreestanding -target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s
#include <xmmintrin.h>
#include <emmintrin.h>
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp
index 68ec2b3..3285c98 100644
--- a/test/CodeGenCXX/mangle-ms.cpp
+++ b/test/CodeGenCXX/mangle-ms.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 -std=c++11 | FileCheck %s
-// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 -std=c++11| FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 -std=c++98 | FileCheck %s
+// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98| FileCheck -check-prefix X64 %s
int a;
// CHECK-DAG: @"\01?a@@3HA"
@@ -95,10 +95,18 @@
// CHECK-DAG: @"\01?h1@@3QAHA"
extern const int * const h2 = &a;
// CHECK-DAG: @"\01?h2@@3QBHB"
+extern int * const __restrict h3 = &a;
+// CHECK-DAG: @"\01?h3@@3QIAHIA"
+// X64-DAG: @"\01?h3@@3QEIAHEIA"
int i[10][20];
// CHECK-DAG: @"\01?i@@3PAY0BE@HA"
+typedef int (*FunT)(int, int);
+FunT FunArr[10][20];
+// CHECK-DAG: @"\01?FunArr@@3PAY0BE@P6AHHH@ZA"
+// X64-DAG: @"\01?FunArr@@3PAY0BE@P6AHHH@ZA"
+
int (__stdcall *j)(signed char, unsigned char);
// CHECK-DAG: @"\01?j@@3P6GHCE@ZA"
@@ -357,10 +365,3 @@
// CHECK-DAG: ??3TypedefNewDelete@@SAXPAX@Z
// CHECK-DAG: ??_VTypedefNewDelete@@SAXPAX@Z
-namespace PR18022 {
-
-struct { } a;
-decltype(a) fun(decltype(a) x, decltype(a)) { return x; }
-// CHECK-DAG: ?fun@PR18022@@YA?AU<unnamed-type-a>@1@U21@0@Z
-
-}
diff --git a/test/CodeGenCXX/mangle-neon-vectors.cpp b/test/CodeGenCXX/mangle-neon-vectors.cpp
index 249ec2e..a9d0b8d 100644
--- a/test/CodeGenCXX/mangle-neon-vectors.cpp
+++ b/test/CodeGenCXX/mangle-neon-vectors.cpp
@@ -1,10 +1,18 @@
-// RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-feature +neon %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-ios -target-feature +neon %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-ios %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-AARCH64
typedef float float32_t;
+typedef double float64_t;
typedef __fp16 float16_t;
+#if defined(__aarch64__)
+typedef unsigned char poly8_t;
+typedef unsigned short poly16_t;
+#else
typedef signed char poly8_t;
typedef short poly16_t;
-typedef unsigned long long uint64_t;
+#endif
+typedef unsigned __INT64_TYPE__ uint64_t;
typedef __attribute__((neon_vector_type(2))) int int32x2_t;
typedef __attribute__((neon_vector_type(4))) int int32x4_t;
@@ -14,26 +22,53 @@
typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
typedef __attribute__((neon_vector_type(4))) float16_t float16x4_t;
typedef __attribute__((neon_vector_type(8))) float16_t float16x8_t;
-typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
-typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
+#ifdef __aarch64__
+typedef __attribute__((neon_vector_type(2))) float64_t float64x2_t;
+#endif
+typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
+typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
// CHECK: 16__simd64_int32_t
+// CHECK-AARCH64: 11__Int32x2_t
void f1(int32x2_t v) { }
+
// CHECK: 17__simd128_int32_t
+// CHECK-AARCH64: 11__Int32x4_t
void f2(int32x4_t v) { }
+
// CHECK: 17__simd64_uint64_t
+// CHECK-AARCH64: 12__Uint64x1_t
void f3(uint64x1_t v) { }
+
// CHECK: 18__simd128_uint64_t
+// CHECK-AARCH64: 12__Uint64x2_t
void f4(uint64x2_t v) { }
+
// CHECK: 18__simd64_float32_t
+// CHECK-AARCH64: 13__Float32x2_t
void f5(float32x2_t v) { }
+
// CHECK: 19__simd128_float32_t
+// CHECK-AARCH64: 13__Float32x4_t
void f6(float32x4_t v) { }
+
// CHECK: 18__simd64_float16_t
+// CHECK-AARCH64: 13__Float16x4_t
void f7(float16x4_t v) {}
+
// CHECK: 19__simd128_float16_t
+// CHECK-AARCH64: 13__Float16x8_t
void f8(float16x8_t v) {}
+
// CHECK: 17__simd128_poly8_t
+// CHECK-AARCH64: 12__Poly8x16_t
void f9(poly8x16_t v) {}
+
// CHECK: 18__simd128_poly16_t
+// CHECK-AARCH64: 12__Poly16x8_t
void f10(poly16x8_t v) {}
+
+#ifdef __aarch64__
+// CHECK-AARCH64: 13__Float64x2_t
+void f11(float64x2_t v) { }
+#endif
diff --git a/test/CodeGenCXX/mangle-nullptr-arg.cpp b/test/CodeGenCXX/mangle-nullptr-arg.cpp
index b55ea6d..66ed7e5 100644
--- a/test/CodeGenCXX/mangle-nullptr-arg.cpp
+++ b/test/CodeGenCXX/mangle-nullptr-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
template<int *ip> struct IP {};
diff --git a/test/CodeGenCXX/mangle-std-externc.cpp b/test/CodeGenCXX/mangle-std-externc.cpp
index a478dee..f0c7d69 100644
--- a/test/CodeGenCXX/mangle-std-externc.cpp
+++ b/test/CodeGenCXX/mangle-std-externc.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -DNS=std -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-STD
-// RUN: %clang_cc1 %s -DNS=n -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-N
+// RUN: %clang_cc1 %s -DNS=std -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s --check-prefix=CHECK-STD
+// RUN: %clang_cc1 %s -DNS=n -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s --check-prefix=CHECK-N
// _ZNSt1DISt1CE1iE = std::D<std::C>::i
// CHECK-STD: @_ZNSt1DISt1CE1iE =
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index 6277c7a..678956e 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -15,8 +15,8 @@
namespace std {
struct A { A(); };
- // CHECK-LABEL: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr
// CHECK-LABEL: define void @_ZNSt1AC2Ev(%"struct.std::A"* %this) unnamed_addr
+ // CHECK-LABEL: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr
A::A() { }
};
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 3b7f302..8fd27b8 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -verify -Wno-return-type -Wno-main -std=c++11 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
+// expected-no-diagnostics
+
namespace test1 {
int x;
template <int& D> class T { };
@@ -156,7 +158,7 @@
namespace test12 {
// Make sure we can mangle non-type template args with internal linkage.
- static int f();
+ static int f() {}
const int n = 10;
template<typename T, T v> void test() {}
void use() {
@@ -182,3 +184,25 @@
template short returnShort<-32768>();
// CHECK: @_ZN6test1311returnShortILsn32768EEEsv()
}
+
+namespace test14 {
+ template <typename> inline int inl(bool b) {
+ if (b) {
+ static struct {
+ int field;
+ } a;
+ // CHECK: @_ZZN6test143inlIvEEibE1a
+
+ return a.field;
+ } else {
+ static struct {
+ int field;
+ } a;
+ // CHECK: @_ZZN6test143inlIvEEibE1a_0
+
+ return a.field;
+ }
+ }
+
+ int call(bool b) { return inl<void>(b); }
+}
diff --git a/test/CodeGenCXX/mangle-windows.cpp b/test/CodeGenCXX/mangle-windows.cpp
index c087616..8564447 100644
--- a/test/CodeGenCXX/mangle-windows.cpp
+++ b/test/CodeGenCXX/mangle-windows.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft \
-// RUN: -triple=i386-pc-win32 | FileCheck --check-prefix=WIN %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | \
+// RUN: FileCheck --check-prefix=WIN %s
//
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | \
// RUN: FileCheck --check-prefix=ITANIUM %s
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index d836f36..ffb6636 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -216,9 +216,9 @@
};
// PR5139
-// CHECK: @_ZN2S7C1Ev
// CHECK: @_ZN2S7C2Ev
// CHECK: @_ZN2S7Ut_C1Ev
+// CHECK: @_ZN2S7C1Ev
S7::S7() {}
// PR5063
diff --git a/test/CodeGenCXX/member-alignment.cpp b/test/CodeGenCXX/member-alignment.cpp
index 78026d4..43ed5e2 100644
--- a/test/CodeGenCXX/member-alignment.cpp
+++ b/test/CodeGenCXX/member-alignment.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
// rdar://7268289
diff --git a/test/CodeGenCXX/member-init-anon-union.cpp b/test/CodeGenCXX/member-init-anon-union.cpp
index bfe1667..b488fa7 100644
--- a/test/CodeGenCXX/member-init-anon-union.cpp
+++ b/test/CodeGenCXX/member-init-anon-union.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -std=c++11 -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
// PR10531.
@@ -21,12 +21,42 @@
int a;
int b = 81;
};
- // CHECK: define {{.*}}_Z1gv
+ // CHECK-LABEL: define {{.*}}_Z1gv
// CHECK-NOT: }
// CHECK: call {{.*}}@"[[CONSTRUCT_LOCAL:.*]]C1Ev"
return b;
}
+struct A {
+ A();
+};
+union B {
+ int k;
+ struct {
+ A x;
+ int y = 123;
+ };
+ B() {}
+ B(int n) : k(n) {}
+};
+
+B b1;
+B b2(0);
+
+
+// CHECK-LABEL: define {{.*}} @_ZN1BC2Ei(
+// CHECK-NOT: call void @_ZN1AC1Ev(
+// CHECK-NOT: store i32 123,
+// CHECK: store i32 %
+// CHECK-NOT: call void @_ZN1AC1Ev(
+// CHECK-NOT: store i32 123,
+// CHECK: }
+
+// CHECK-LABEL: define {{.*}} @_ZN1BC2Ev(
+// CHECK: call void @_ZN1AC1Ev(
+// CHECK: store i32 123,
+// CHECK: }
+
// CHECK: define {{.*}}@"[[CONSTRUCT_LOCAL]]C2Ev"
// CHECK-NOT: }
diff --git a/test/CodeGenCXX/member-templates.cpp b/test/CodeGenCXX/member-templates.cpp
index c72dd6e..93d36ff 100644
--- a/test/CodeGenCXX/member-templates.cpp
+++ b/test/CodeGenCXX/member-templates.cpp
@@ -15,8 +15,8 @@
template<typename T> B::B(T) {}
-// CHECK-LABEL: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32) unnamed_addr
// CHECK-LABEL: define weak_odr void @_ZN1BC2IiEET_(%struct.B* %this, i32) unnamed_addr
+// CHECK-LABEL: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32) unnamed_addr
template B::B(int);
template<typename T>
diff --git a/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp b/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp
index 7407efe..c8477f4 100644
--- a/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp
+++ b/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=i686-pc-win32 -o - %s 2>/dev/null | FileCheck %s
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=x86_64-pc-win32 -o - %s 2>/dev/null | FileCheck %s -check-prefix CHECK-X64
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=i686-pc-win32 -o - %s 2>/dev/null | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 -o - %s 2>/dev/null | FileCheck %s -check-prefix CHECK-X64
struct B { char a; };
struct A : virtual B {} a;
// The <> indicate that the pointer is packed, which is required to support
// microsoft layout in 32 bit mode, but not 64 bit mode.
-// CHECK: %struct.A = type <{ i32*, %struct.B }>
-// CHECK-X64: %struct.A = type { i32*, %struct.B }
+// CHECK: %struct.A = type <{ i32*, %struct.B }>
+// CHECK-X64: %struct.A = type { i32*, %struct.B }
diff --git a/test/CodeGenCXX/microsoft-abi-arg-order.cpp b/test/CodeGenCXX/microsoft-abi-arg-order.cpp
new file mode 100644
index 0000000..01f6f47
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-arg-order.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -mconstructor-aliases -std=c++11 -fexceptions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+
+struct A {
+ A(int a);
+ ~A();
+ int a;
+};
+
+void foo(A a, A b, A c) {
+}
+
+// Order of destruction should be left to right.
+//
+// CHECK-LABEL: define void @"\01?foo@@YAXUA@@00@Z"
+// CHECK: ([[argmem_ty:<{ %struct.A, %struct.A, %struct.A }>]]* inalloca)
+// CHECK: %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %0, i32 0, i32 0
+// CHECK: %[[b:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %0, i32 0, i32 1
+// CHECK: %[[c:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %0, i32 0, i32 2
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[a]])
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[b]])
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[c]])
+// CHECK: ret void
+
+
+void call_foo() {
+ foo(A(1), A(2), A(3));
+}
+
+// Order of evaluation should be right to left, and we should clean up the right
+// things as we unwind.
+//
+// CHECK-LABEL: define void @"\01?call_foo@@YAXXZ"()
+// CHECK: call i8* @llvm.stacksave()
+// CHECK: %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
+// CHECK: %[[arg3:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 2
+// CHECK: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@H@Z"(%struct.A* %[[arg3]], i32 3)
+// CHECK: %[[arg2:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
+// CHECK: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@H@Z"(%struct.A* %[[arg2]], i32 2)
+// CHECK: %[[arg1:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
+// CHECK: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@H@Z"(%struct.A* %[[arg1]], i32 1)
+// CHECK: invoke void @"\01?foo@@YAXUA@@00@Z"([[argmem_ty]]* inalloca %[[argmem]])
+// CHECK: call void @llvm.stackrestore
+// CHECK: ret void
+//
+// lpad2:
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[arg2]])
+// CHECK: br label
+//
+// ehcleanup:
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[arg3]])
diff --git a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
index 1ba1f6a..8da4fcf 100644
--- a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
+++ b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
struct ClassWithoutDtor {
char x;
diff --git a/test/CodeGenCXX/microsoft-abi-byval-sret.cpp b/test/CodeGenCXX/microsoft-abi-byval-sret.cpp
new file mode 100644
index 0000000..985b1ce
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-byval-sret.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i686-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck %s
+
+struct A {
+ A() : a(42) {}
+ A(const A &o) : a(o.a) {}
+ ~A() {}
+ int a;
+ A foo(A o);
+};
+
+A A::foo(A x) {
+ A y(*this);
+ y.a += x.a;
+ return y;
+}
+
+// CHECK-LABEL: define x86_thiscallcc %struct.A* @"\01?foo@A@@QAE?AU1@U1@@Z"
+// CHECK: (%struct.A* %this, <{ %struct.A*, %struct.A }>* inalloca)
+// CHECK: getelementptr inbounds <{ %struct.A*, %struct.A }>* %{{.*}}, i32 0, i32 0
+// CHECK: load %struct.A**
+// CHECK: ret %struct.A*
+
+int main() {
+ A x;
+ A y = x.foo(x);
+}
+
+// CHECK: call x86_thiscallcc %struct.A* @"\01?foo@A@@QAE?AU1@U1@@Z"
+// CHECK: (%struct.A* %{{[^,]*}}, <{ %struct.A*, %struct.A }>* inalloca %{{[^,]*}})
diff --git a/test/CodeGenCXX/microsoft-abi-byval-vararg.cpp b/test/CodeGenCXX/microsoft-abi-byval-vararg.cpp
new file mode 100644
index 0000000..3361921
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-byval-vararg.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i686-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck %s
+
+#include <stdarg.h>
+
+struct A {
+ A(int a) : a(a) {}
+ A(const A &o) : a(o.a) {}
+ ~A() {}
+ int a;
+};
+
+int foo(A a, ...) {
+ va_list ap;
+ va_start(ap, a);
+ int sum = 0;
+ for (int i = 0; i < a.a; ++i)
+ sum += va_arg(ap, int);
+ va_end(ap);
+ return sum;
+}
+
+int main() {
+ return foo(A(3), 1, 2, 3);
+}
+// CHECK-LABEL: define i32 @main()
+// CHECK: %[[argmem_cast:[^ ]*]] = bitcast <{ %struct.A, i32, i32, i32 }>* %argmem to <{ %struct.A }>*
+// CHECK: call i32 (<{ %struct.A }>*, ...)* @"\01?foo@@YAHUA@@ZZ"(<{ %struct.A }>* inalloca %[[argmem_cast]])
diff --git a/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp b/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp
new file mode 100644
index 0000000..fc3e2ca
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple i386-pc-win32 -emit-llvm %s -o - | FileCheck %s
+
+// PR15768
+
+// A trivial 12 byte struct is returned indirectly.
+struct S {
+ S();
+ int a, b, c;
+};
+
+struct C {
+ S variadic_sret(const char *f, ...);
+ S __cdecl cdecl_sret();
+ S __cdecl byval_and_sret(S a);
+ int c;
+};
+
+S C::variadic_sret(const char *f, ...) { return S(); }
+S C::cdecl_sret() { return S(); }
+S C::byval_and_sret(S a) { return S(); }
+
+// CHECK: define x86_cdeclmethodcc void @"\01?variadic_sret@C@@QAA?AUS@@PBDZZ"(%struct.S* noalias sret %agg.result, %struct.C* %this, i8* %f, ...)
+// CHECK: define x86_cdeclmethodcc void @"\01?cdecl_sret@C@@QAA?AUS@@XZ"(%struct.S* noalias sret %agg.result, %struct.C* %this)
+// CHECK: define x86_cdeclmethodcc void @"\01?byval_and_sret@C@@QAA?AUS@@U2@@Z"(%struct.S* noalias sret %agg.result, %struct.C* %this, %struct.S* byval align 4 %a)
+
+int main() {
+ C c;
+ c.variadic_sret("asdf");
+ c.cdecl_sret();
+ c.byval_and_sret(S());
+}
+// CHECK-LABEL: define i32 @main()
+// CHECK: call x86_cdeclmethodcc void {{.*}} @"\01?variadic_sret@C@@QAA?AUS@@PBDZZ"
+// CHECK: call x86_cdeclmethodcc void @"\01?cdecl_sret@C@@QAA?AUS@@XZ"
+// CHECK: call x86_cdeclmethodcc void @"\01?byval_and_sret@C@@QAA?AUS@@U2@@Z"
diff --git a/test/CodeGenCXX/microsoft-abi-constexpr-vs-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-constexpr-vs-inheritance.cpp
index 92db9a7..319f39c 100644
--- a/test/CodeGenCXX/microsoft-abi-constexpr-vs-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-constexpr-vs-inheritance.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
struct A {
constexpr A(int x) : x(x) {}
diff --git a/test/CodeGenCXX/microsoft-abi-default-cc.cpp b/test/CodeGenCXX/microsoft-abi-default-cc.cpp
index d7fba99..e3ca392 100644
--- a/test/CodeGenCXX/microsoft-abi-default-cc.cpp
+++ b/test/CodeGenCXX/microsoft-abi-default-cc.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck -check-prefix GCABI %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -DMS_ABI -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck -check-prefix MSABI %s
+// RUN: %clang_cc1 -triple i386-pc-linux -emit-llvm %s -o - | FileCheck -check-prefix GCABI %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -DMS_ABI -triple=i386-pc-win32 | FileCheck -check-prefix MSABI %s
#ifdef MS_ABI
# define METHOD_CC __thiscall
diff --git a/test/CodeGenCXX/microsoft-abi-exceptions.cpp b/test/CodeGenCXX/microsoft-abi-exceptions.cpp
index 7757ea0..60a3514 100644
--- a/test/CodeGenCXX/microsoft-abi-exceptions.cpp
+++ b/test/CodeGenCXX/microsoft-abi-exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -cxx-abi microsoft -fexceptions -fno-rtti | FileCheck -check-prefix WIN32 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fno-rtti | FileCheck -check-prefix WIN32 %s
struct A {
A();
@@ -14,17 +14,21 @@
}
// With exceptions, we need to clean up at least one of these temporaries.
-// WIN32: define void @"\01?HasEHCleanup@@YAXXZ"() {{.*}} {
-// First one doesn't have any cleanups, no need for invoke.
-// WIN32: call void @"\01?getA@@YA?AUA@@XZ"(%struct.A* sret %{{.*}})
+// WIN32-LABEL: define void @"\01?HasEHCleanup@@YAXXZ"() {{.*}} {
+// WIN32: %[[base:.*]] = call i8* @llvm.stacksave()
+// If this call throws, we have to restore the stack.
+// WIN32: invoke void @"\01?getA@@YA?AUA@@XZ"(%struct.A* sret %{{.*}})
// If this call throws, we have to cleanup the first temporary.
// WIN32: invoke void @"\01?getA@@YA?AUA@@XZ"(%struct.A* sret %{{.*}})
-// If this call throws, we already popped our cleanups
-// WIN32: call i32 @"\01?TakesTwo@@YAHUA@@0@Z"
+// If this call throws, we have to cleanup the stacksave.
+// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"
+// WIN32: call void @llvm.stackrestore(i8* %[[base]])
// WIN32: ret void
//
// There should be one dtor call for unwinding from the second getA.
// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
+// WIN32-NOT: @"\01??1A@@QAE@XZ"
+// WIN32: call void @llvm.stackrestore
// WIN32: }
void TakeRef(const A &a);
@@ -32,20 +36,28 @@
return TakesTwo((TakeRef(A()), A()), (TakeRef(A()), A()));
}
-// WIN32: define i32 @"\01?HasDeactivatedCleanups@@YAHXZ"() {{.*}} {
+// WIN32-LABEL: define i32 @"\01?HasDeactivatedCleanups@@YAHXZ"() {{.*}} {
// WIN32: %[[isactive:.*]] = alloca i1
-// WIN32: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32: call i8* @llvm.stacksave()
+// WIN32: %[[argmem:.*]] = alloca inalloca [[argmem_ty:<{ %struct.A, %struct.A }>]]
+// WIN32: %[[arg1:.*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
+// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z"
-// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %[[arg1:.*]])
+//
+// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %[[arg1]])
// WIN32: store i1 true, i1* %[[isactive]]
+//
+// WIN32: %[[arg0:.*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z"
// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: store i1 false, i1* %[[isactive]]
-// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"
+//
+// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"([[argmem_ty]]* inalloca %[[argmem]])
+// WIN32: call void @llvm.stackrestore
// Destroy the two const ref temporaries.
// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
-// WIN32: call x86_thiscallcc void @"\01??1A@@QAE@XZ"
+// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
// WIN32: ret i32
//
// Conditionally destroy arg1.
@@ -60,20 +72,22 @@
return (cond ? TakesTwo(A(), A()) : CouldThrow());
}
-// WIN32: define i32 @"\01?HasConditionalCleanup@@YAH_N@Z"(i1 zeroext %{{.*}}) {{.*}} {
+// WIN32-LABEL: define i32 @"\01?HasConditionalCleanup@@YAH_N@Z"(i1 zeroext %{{.*}}) {{.*}} {
// WIN32: store i1 false
// WIN32: br i1
-// No cleanups, so we call and then activate a cleanup if it succeeds.
-// WIN32: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %[[arg1:.*]])
-// WIN32: store i1 true
-// Now we have a cleanup for the first aggregate, so we invoke.
+// WIN32: call i8* @llvm.stacksave()
// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %{{.*}})
-// Now we have no cleanups because TakeTwo will destruct both args.
-// WIN32: call i32 @"\01?TakesTwo@@YAHUA@@0@Z"
-// Still no cleanups, so call.
+// WIN32: store i1 true
+// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %{{.*}})
+// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"
+// WIN32: call void @llvm.stackrestore
+//
// WIN32: call i32 @"\01?CouldThrow@@YAHXZ"()
-// Somewhere in the landing pad for our single invoke, call the dtor.
-// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[arg1]])
+//
+// Only one dtor in the invoke for arg1
+// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}})
+// WIN32-NOT: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
+// WIN32: call void @llvm.stackrestore
// WIN32: }
// Now test both.
@@ -81,8 +95,7 @@
return (cond ? TakesTwo((TakeRef(A()), A()), (TakeRef(A()), A())) : CouldThrow());
}
-// WIN32: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} {
-// WIN32: %[[arg1:.*]] = alloca %struct.A, align 4
+// WIN32-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} {
// WIN32: alloca i1
// WIN32: %[[arg1_cond:.*]] = alloca i1
// Start all four cleanups as deactivated.
@@ -92,10 +105,10 @@
// WIN32: store i1 false
// WIN32: br i1
// True condition.
-// WIN32: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: store i1 true
// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z"
-// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"(%struct.A* %[[arg1]])
+// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: store i1 true, i1* %[[arg1_cond]]
// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
// WIN32: store i1 true
@@ -108,13 +121,13 @@
// WIN32: invoke i32 @"\01?CouldThrow@@YAHXZ"()
// Two normal cleanups for TakeRef args.
// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
-// WIN32: call x86_thiscallcc void @"\01??1A@@QAE@XZ"
+// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
// WIN32: ret i32
//
// Somewhere in the landing pad soup, we conditionally destroy arg1.
// WIN32: %[[isactive:.*]] = load i1* %[[arg1_cond]]
// WIN32: br i1 %[[isactive]]
-// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %[[arg1]])
+// WIN32: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
// WIN32: }
namespace crash_on_partial_destroy {
diff --git a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
index c0dcd3c..8d9a848 100644
--- a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -1,7 +1,10 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 -DINCOMPLETE_VIRTUAL -fms-extensions -verify
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 -DINCOMPLETE_VIRTUAL -DMEMFUN -fms-extensions -verify
// FIXME: Test x86_64 member pointers when codegen no longer asserts on records
// with virtual bases.
+#ifndef INCOMPLETE_VIRTUAL
struct B1 {
void foo();
int b;
@@ -56,20 +59,20 @@
// CHECK: @"\01?p_d_memptr@@3PQPolymorphic@@HQ1@" = global i32 0, align 4
// CHECK: @"\01?m_d_memptr@@3PQMultiple@@HQ1@" = global i32 -1, align 4
// CHECK: @"\01?v_d_memptr@@3PQVirtual@@HQ1@" = global { i32, i32 }
-// CHECK: { i32 0, i32 -1 }, align 4
+// CHECK: { i32 0, i32 -1 }, align 8
// CHECK: @"\01?n_d_memptr@@3PQNonZeroVBPtr@@HQ1@" = global { i32, i32 }
-// CHECK: { i32 0, i32 -1 }, align 4
+// CHECK: { i32 0, i32 -1 }, align 8
// CHECK: @"\01?u_d_memptr@@3PQUnspecified@@HQ1@" = global { i32, i32, i32 }
-// CHECK: { i32 0, i32 0, i32 -1 }, align 4
+// CHECK: { i32 0, i32 0, i32 -1 }, align 8
// CHECK: @"\01?us_d_memptr@@3PQUnspecSingle@@HQ1@" = global { i32, i32, i32 }
-// CHECK: { i32 0, i32 0, i32 -1 }, align 4
+// CHECK: { i32 0, i32 0, i32 -1 }, align 8
void (Single ::*s_f_memptr)();
void (Multiple::*m_f_memptr)();
void (Virtual ::*v_f_memptr)();
// CHECK: @"\01?s_f_memptr@@3P8Single@@AEXXZQ1@" = global i8* null, align 4
-// CHECK: @"\01?m_f_memptr@@3P8Multiple@@AEXXZQ1@" = global { i8*, i32 } zeroinitializer, align 4
-// CHECK: @"\01?v_f_memptr@@3P8Virtual@@AEXXZQ1@" = global { i8*, i32, i32 } zeroinitializer, align 4
+// CHECK: @"\01?m_f_memptr@@3P8Multiple@@AEXXZQ1@" = global { i8*, i32 } zeroinitializer, align 8
+// CHECK: @"\01?v_f_memptr@@3P8Virtual@@AEXXZQ1@" = global { i8*, i32, i32 } zeroinitializer, align 8
// We can define Unspecified after locking in the inheritance model.
struct Unspecified : Multiple, Virtual {
@@ -91,13 +94,13 @@
// CHECK: @"\01?s_f_mp@Const@@3P8Single@@AEXXZQ2@" =
// CHECK: global i8* bitcast ({{.*}} @"\01?foo@Single@@QAEXXZ" to i8*), align 4
// CHECK: @"\01?m_f_mp@Const@@3P8Multiple@@AEXXZQ2@" =
-// CHECK: global { i8*, i32 } { i8* bitcast ({{.*}} @"\01?foo@B2@@QAEXXZ" to i8*), i32 4 }, align 4
+// CHECK: global { i8*, i32 } { i8* bitcast ({{.*}} @"\01?foo@B2@@QAEXXZ" to i8*), i32 4 }, align 8
// CHECK: @"\01?v_f_mp@Const@@3P8Virtual@@AEXXZQ2@" =
-// CHECK: global { i8*, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Virtual@@QAEXXZ" to i8*), i32 0, i32 0 }, align 4
+// CHECK: global { i8*, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Virtual@@QAEXXZ" to i8*), i32 0, i32 0 }, align 8
// CHECK: @"\01?u_f_mp@Const@@3P8Unspecified@@AEXXZQ2@" =
-// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 }, align 4
+// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 }, align 8
// CHECK: @"\01?us_f_mp@Const@@3P8UnspecSingle@@AEXXZQ2@" =
-// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@UnspecSingle@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, align 4
+// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@UnspecSingle@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, align 8
}
namespace CastParam {
@@ -119,11 +122,11 @@
// Try a reinterpret_cast followed by a memptr conversion.
void (C::*ptr2)(void *) = (void (C::*)(void *)) (void (A::*)(void *)) &A::foo;
// CHECK: @"\01?ptr2@CastParam@@3P8C@1@AEXPAX@ZQ21@" =
-// CHECK: global { i8*, i32 } { i8* bitcast (void ({{.*}})* @"\01?foo@A@CastParam@@QAEXPAU12@@Z" to i8*), i32 4 }, align 4
+// CHECK: global { i8*, i32 } { i8* bitcast (void ({{.*}})* @"\01?foo@A@CastParam@@QAEXPAU12@@Z" to i8*), i32 4 }, align 8
void (C::*ptr3)(void *) = (void (C::*)(void *)) (void (A::*)(void *)) (void (A::*)(A *)) 0;
// CHECK: @"\01?ptr3@CastParam@@3P8C@1@AEXPAX@ZQ21@" =
-// CHECK: global { i8*, i32 } zeroinitializer, align 4
+// CHECK: global { i8*, i32 } zeroinitializer, align 8
struct D : C {
virtual void isPolymorphic();
@@ -156,23 +159,23 @@
void (UnspecWithVBPtr::*u2_f_memptr)() = &UnspecWithVBPtr::foo;
// CHECK: define void @"\01?EmitNonVirtualMemberPointers@@YAXXZ"() {{.*}} {
// CHECK: alloca i8*, align 4
-// CHECK: alloca { i8*, i32 }, align 4
-// CHECK: alloca { i8*, i32, i32 }, align 4
-// CHECK: alloca { i8*, i32, i32, i32 }, align 4
+// CHECK: alloca { i8*, i32 }, align 8
+// CHECK: alloca { i8*, i32, i32 }, align 8
+// CHECK: alloca { i8*, i32, i32, i32 }, align 8
// CHECK: store i8* bitcast (void (%{{.*}}*)* @"\01?foo@Single@@QAEXXZ" to i8*), i8** %{{.*}}, align 4
// CHECK: store { i8*, i32 }
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Multiple@@QAEXXZ" to i8*), i32 0 },
-// CHECK: { i8*, i32 }* %{{.*}}, align 4
+// CHECK: { i8*, i32 }* %{{.*}}, align 8
// CHECK: store { i8*, i32, i32 }
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Virtual@@QAEXXZ" to i8*), i32 0, i32 0 },
-// CHECK: { i8*, i32, i32 }* %{{.*}}, align 4
+// CHECK: { i8*, i32, i32 }* %{{.*}}, align 8
// CHECK: store { i8*, i32, i32, i32 }
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 },
-// CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 4
+// CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 8
// CHECK: store { i8*, i32, i32, i32 }
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@UnspecWithVBPtr@@QAEXXZ" to i8*),
// CHECK: i32 0, i32 4, i32 0 },
-// CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 4
+// CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 8
// CHECK: ret void
// CHECK: }
}
@@ -219,9 +222,9 @@
bool nullTestDataUnspecified(int Unspecified::*mp) {
return mp;
// CHECK: define zeroext i1 @"\01?nullTestDataUnspecified@@YA_NPQUnspecified@@H@Z"{{.*}} {
-// CHECK: %{{.*}} = load { i32, i32, i32 }* %{{.*}}, align 4
-// CHECK: store { i32, i32, i32 } {{.*}} align 4
-// CHECK: %[[mp:.*]] = load { i32, i32, i32 }* %{{.*}}, align 4
+// CHECK: %{{.*}} = load { i32, i32, i32 }* %{{.*}}, align 8
+// CHECK: store { i32, i32, i32 } {{.*}} align 8
+// CHECK: %[[mp:.*]] = load { i32, i32, i32 }* %{{.*}}, align 8
// CHECK: %[[mp0:.*]] = extractvalue { i32, i32, i32 } %[[mp]], 0
// CHECK: %[[cmp0:.*]] = icmp ne i32 %[[mp0]], 0
// CHECK: %[[mp1:.*]] = extractvalue { i32, i32, i32 } %[[mp]], 1
@@ -237,9 +240,9 @@
bool nullTestFunctionUnspecified(void (Unspecified::*mp)()) {
return mp;
// CHECK: define zeroext i1 @"\01?nullTestFunctionUnspecified@@YA_NP8Unspecified@@AEXXZ@Z"{{.*}} {
-// CHECK: %{{.*}} = load { i8*, i32, i32, i32 }* %{{.*}}, align 4
-// CHECK: store { i8*, i32, i32, i32 } {{.*}} align 4
-// CHECK: %[[mp:.*]] = load { i8*, i32, i32, i32 }* %{{.*}}, align 4
+// CHECK: %{{.*}} = load { i8*, i32, i32, i32 }* %{{.*}}, align 8
+// CHECK: store { i8*, i32, i32, i32 } {{.*}} align 8
+// CHECK: %[[mp:.*]] = load { i8*, i32, i32, i32 }* %{{.*}}, align 8
// CHECK: %[[mp0:.*]] = extractvalue { i8*, i32, i32, i32 } %[[mp]], 0
// CHECK: %[[cmp0:.*]] = icmp ne i8* %[[mp0]], null
// CHECK: ret i1 %[[cmp0]]
@@ -252,7 +255,7 @@
// data pointer.
// CHECK: define i32 @"\01?loadDataMemberPointerVirtual@@YAHPAUVirtual@@PQ1@H@Z"{{.*}} {
// CHECK: %[[o:.*]] = load %{{.*}}** %{{.*}}, align 4
-// CHECK: %[[memptr:.*]] = load { i32, i32 }* %{{.*}}, align 4
+// CHECK: %[[memptr:.*]] = load { i32, i32 }* %{{.*}}, align 8
// CHECK: %[[memptr0:.*]] = extractvalue { i32, i32 } %[[memptr:.*]], 0
// CHECK: %[[memptr1:.*]] = extractvalue { i32, i32 } %[[memptr:.*]], 1
// CHECK: %[[v6:.*]] = bitcast %{{.*}}* %[[o]] to i8*
@@ -276,7 +279,7 @@
// data pointer.
// CHECK: define i32 @"\01?loadDataMemberPointerUnspecified@@YAHPAUUnspecified@@PQ1@H@Z"{{.*}} {
// CHECK: %[[o:.*]] = load %{{.*}}** %{{.*}}, align 4
-// CHECK: %[[memptr:.*]] = load { i32, i32, i32 }* %{{.*}}, align 4
+// CHECK: %[[memptr:.*]] = load { i32, i32, i32 }* %{{.*}}, align 8
// CHECK: %[[memptr0:.*]] = extractvalue { i32, i32, i32 } %[[memptr:.*]], 0
// CHECK: %[[memptr1:.*]] = extractvalue { i32, i32, i32 } %[[memptr:.*]], 1
// CHECK: %[[memptr2:.*]] = extractvalue { i32, i32, i32 } %[[memptr:.*]], 2
@@ -462,7 +465,7 @@
//
// CHECK: define i32 @"\01?convertMultipleFuncToB2@@YAP8B2@@AEXXZP8Multiple@@AEXXZ@Z"{{.*}} {
// CHECK: store
-// CHECK: %[[src:.*]] = load { i8*, i32 }* %{{.*}}, align 4
+// CHECK: %[[src:.*]] = load { i8*, i32 }* %{{.*}}, align 8
// CHECK: extractvalue { i8*, i32 } %[[src]], 0
// CHECK: icmp ne i8* %{{.*}}, null
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
@@ -487,7 +490,7 @@
return mp;
// CHECK: define void @"\01?convertCToD@Test1@@YAP8D@1@AEXXZP8C@1@AEXXZ@Z"{{.*}} {
// CHECK: store
-// CHECK: load { i8*, i32, i32 }* %{{.*}}, align 4
+// CHECK: load { i8*, i32, i32 }* %{{.*}}, align 8
// CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 0
// CHECK: icmp ne i8* %{{.*}}, null
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
@@ -537,3 +540,58 @@
}
}
+
+namespace Test3 {
+// Make sure we cast 'this' to i8* before using GEP.
+
+struct A {
+ int a;
+ int b;
+};
+
+int *load_data(A *a, int A::*mp) {
+ return &(a->*mp);
+// CHECK-LABEL: define i32* @"\01?load_data@Test3@@YAPAHPAUA@1@PQ21@H@Z"{{.*}} {
+// CHECK: %[[a:.*]] = load %"struct.Test3::A"** %{{.*}}, align 4
+// CHECK: %[[mp:.*]] = load i32* %{{.*}}, align 4
+// CHECK: %[[a_i8:.*]] = bitcast %"struct.Test3::A"* %[[a]] to i8*
+// CHECK: getelementptr inbounds i8* %[[a_i8]], i32 %[[mp]]
+// CHECK: }
+}
+
+}
+
+namespace Test4 {
+
+struct A { virtual void f(); };
+struct B { virtual void g(); };
+struct C : A, B { virtual void g(); };
+
+void (C::*getmp())() {
+ return &C::g;
+}
+// CHECK-LABEL: define i64 @"\01?getmp@Test4@@YAP8C@1@AEXXZXZ"()
+// CHECK: store { i8*, i32 } { i8* bitcast (void (i8*)* @"\01??_9C@Test4@@$BA@AE" to i8*), i32 4 }, { i8*, i32 }* %{{.*}}
+//
+
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @"\01??_9C@Test4@@$BA@AE"(i8*)
+// CHECK-NOT: getelementptr
+// CHECK: load void (i8*)*** %{{.*}}
+// CHECK: getelementptr inbounds void (i8*)** %{{.*}}, i64 0
+// CHECK-NOT: getelementptr
+// CHECK: call x86_thiscallcc void %
+
+}
+
+#else
+struct __virtual_inheritance A;
+#ifdef MEMFUN
+int foo(A *a, int (A::*mp)()) {
+ return (a->*mp)(); // expected-error{{requires a complete class type}}
+}
+#else
+int foo(A *a, int A::*mp) {
+ return a->*mp; // expected-error{{requires a complete class type}}
+}
+#endif
+#endif
diff --git a/test/CodeGenCXX/microsoft-abi-methods.cpp b/test/CodeGenCXX/microsoft-abi-methods.cpp
index c996ba5..579e549 100644
--- a/test/CodeGenCXX/microsoft-abi-methods.cpp
+++ b/test/CodeGenCXX/microsoft-abi-methods.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
class C {
public:
diff --git a/test/CodeGenCXX/microsoft-abi-multiple-nonvirtual-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-multiple-nonvirtual-inheritance.cpp
index 802f0ca..b1c1482 100644
--- a/test/CodeGenCXX/microsoft-abi-multiple-nonvirtual-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-multiple-nonvirtual-inheritance.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -mconstructor-aliases -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
struct Left {
virtual void left();
diff --git a/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp b/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
new file mode 100755
index 0000000..0c82ac3
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=i686-pc-win32 -o - %s 2>/dev/null | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 -o - %s 2>/dev/null | FileCheck %s
+
+struct C0 { int a; };
+struct C1 { int a; virtual void C1M() {} };
+struct C2 { int a; virtual void C2M() {} };
+struct C3 : C0, C1, C2 {} a;
+
+// Check to see that both C1 and C2 get laid out before C0 does.
+// CHECK: %struct.C3 = type { %struct.C1, %struct.C2, %struct.C0 }
diff --git a/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp b/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
index d0750e6..3d5fe9c 100644
--- a/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
+++ b/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN32 %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN64 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN32 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck -check-prefix WIN64 %s
struct Empty {};
@@ -47,6 +47,14 @@
int a, b, c, d, e, f;
};
+// WIN32: declare void @"{{.*take_bools_and_chars.*}}"
+// WIN32: (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor,
+// WIN32: i8, [3 x i8], i8, [3 x i8], i32, i8 }>* inalloca)
+void take_bools_and_chars(char a, char b, SmallWithDtor c, char d, bool e, int f, bool g);
+void call_bools_and_chars() {
+ take_bools_and_chars('A', 'B', SmallWithDtor(), 'D', true, 13, false);
+}
+
// Returning structs that fit into a register.
Small small_return() { return Small(); }
// LINUX-LABEL: define void @_Z12small_returnv(%struct.Small* noalias sret %agg.result)
@@ -103,11 +111,11 @@
// Test that dtors are invoked in the callee.
void small_arg_with_dtor(SmallWithDtor s) {}
-// WIN32: define void @"\01?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(%struct.SmallWithDtor* byval align 4 %s) {{.*}} {
-// WIN32: call x86_thiscallcc void @"\01??1SmallWithDtor@@QAE@XZ"(%struct.SmallWithDtor* %s)
+// WIN32: define void @"\01?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(<{ %struct.SmallWithDtor }>* inalloca) {{.*}} {
+// WIN32: call x86_thiscallcc void @"\01??1SmallWithDtor@@QAE@XZ"
// WIN32: }
-// WIN64: define void @"\01?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(%struct.SmallWithDtor* byval %s) {{.*}} {
-// WIN64: call void @"\01??1SmallWithDtor@@QEAA@XZ"(%struct.SmallWithDtor* %s)
+// WIN64: define void @"\01?small_arg_with_dtor@@YAXUSmallWithDtor@@@Z"(%struct.SmallWithDtor* %s) {{.*}} {
+// WIN64: call void @"\01??1SmallWithDtor@@QEAA@XZ"
// WIN64: }
// Test that references aren't destroyed in the callee.
@@ -141,13 +149,13 @@
void small_arg_with_vftable(SmallWithVftable s) {}
// LINUX-LABEL: define void @_Z22small_arg_with_vftable16SmallWithVftable(%struct.SmallWithVftable* %s)
-// WIN32: define void @"\01?small_arg_with_vftable@@YAXUSmallWithVftable@@@Z"(%struct.SmallWithVftable* byval align 4 %s)
-// WIN64: define void @"\01?small_arg_with_vftable@@YAXUSmallWithVftable@@@Z"(%struct.SmallWithVftable* byval %s)
+// WIN32: define void @"\01?small_arg_with_vftable@@YAXUSmallWithVftable@@@Z"(<{ %struct.SmallWithVftable }>* inalloca)
+// WIN64: define void @"\01?small_arg_with_vftable@@YAXUSmallWithVftable@@@Z"(%struct.SmallWithVftable* %s)
void medium_arg_with_copy_ctor(MediumWithCopyCtor s) {}
// LINUX-LABEL: define void @_Z25medium_arg_with_copy_ctor18MediumWithCopyCtor(%struct.MediumWithCopyCtor* %s)
-// WIN32: define void @"\01?medium_arg_with_copy_ctor@@YAXUMediumWithCopyCtor@@@Z"(%struct.MediumWithCopyCtor* byval align 4 %s)
-// WIN64: define void @"\01?medium_arg_with_copy_ctor@@YAXUMediumWithCopyCtor@@@Z"(%struct.MediumWithCopyCtor* byval %s)
+// WIN32: define void @"\01?medium_arg_with_copy_ctor@@YAXUMediumWithCopyCtor@@@Z"(<{ %struct.MediumWithCopyCtor }>* inalloca)
+// WIN64: define void @"\01?medium_arg_with_copy_ctor@@YAXUMediumWithCopyCtor@@@Z"(%struct.MediumWithCopyCtor* %s)
void big_arg(Big s) {}
// LINUX-LABEL: define void @_Z7big_arg3Big(%struct.Big* byval align 4 %s)
@@ -167,10 +175,7 @@
Small __cdecl cdecl_method_small() { return Small(); }
// LINUX: define {{.*}} void @_ZN5Class18cdecl_method_smallEv(%struct.Small* noalias sret %agg.result, %class.Class* %this)
- // FIXME: Interesting, cdecl returns structures differently for instance
- // methods and global functions. This is not supported by Clang yet...
- // FIXME: Replace WIN32-NOT with WIN32 when this is fixed.
- // WIN32-NOT: define {{.*}} void @"\01?cdecl_method_small@Class@@QAA?AUSmall@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)
+ // WIN32: define {{.*}} void @"\01?cdecl_method_small@Class@@QAA?AUSmall@@XZ"(%struct.Small* noalias sret %agg.result, %class.Class* %this)
Big __cdecl cdecl_method_big() { return Big(); }
// LINUX: define {{.*}} void @_ZN5Class16cdecl_method_bigEv(%struct.Big* noalias sret %agg.result, %class.Class* %this)
@@ -218,8 +223,8 @@
};
void g(X) {
}
-// WIN32: define void @"\01?g@@YAXUX@@@Z"(%struct.X* byval align 4) {{.*}} {
-// WIN32: call x86_thiscallcc void @"\01??1X@@QAE@XZ"(%struct.X* %0)
+// WIN32: define void @"\01?g@@YAXUX@@@Z"(<{ %struct.X }>* inalloca) {{.*}} {
+// WIN32: call x86_thiscallcc void @"\01??1X@@QAE@XZ"(%struct.X* {{.*}})
// WIN32: }
void f() {
g(X());
@@ -227,3 +232,58 @@
// WIN32: define void @"\01?f@@YAXXZ"() {{.*}} {
// WIN32-NOT: call {{.*}} @"\01??1X@@QAE@XZ"
// WIN32: }
+
+
+namespace test2 {
+// We used to crash on this due to the mixture of POD byval and non-trivial
+// byval.
+
+struct NonTrivial {
+ NonTrivial();
+ NonTrivial(const NonTrivial &o);
+ ~NonTrivial();
+ int a;
+};
+struct POD { int b; };
+
+int foo(NonTrivial a, POD b);
+void bar() {
+ POD b;
+ b.b = 13;
+ int c = foo(NonTrivial(), b);
+}
+// WIN32-LABEL: define void @"\01?bar@test2@@YAXXZ"() {{.*}} {
+// WIN32: %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty:<{ %"struct.test2::NonTrivial", %"struct.test2::POD" }>]]
+// WIN32: getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
+// WIN32: call void @llvm.memcpy
+// WIN32: getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
+// WIN32: call x86_thiscallcc %"struct.test2::NonTrivial"* @"\01??0NonTrivial@test2@@QAE@XZ"
+// WIN32: call i32 @"\01?foo@test2@@YAHUNonTrivial@1@UPOD@1@@Z"([[argmem_ty]]* inalloca %argmem)
+// WIN32: ret void
+// WIN32: }
+
+}
+
+// We would crash here because the later definition of ForwardDeclare1 results
+// in a different IR type for the value we want to store. However, the alloca's
+// type will use the argument type selected by fn1.
+struct ForwardDeclare1;
+
+typedef void (*FnPtr1)(ForwardDeclare1);
+void fn1(FnPtr1 a, SmallWithDtor b) { }
+
+struct ForwardDeclare1 {};
+
+void fn2(FnPtr1 a, SmallWithDtor b) { fn1(a, b); };
+// WIN32-LABEL: define void @"\01?fn2@@YAXP6AXUForwardDeclare1@@@ZUSmallWithDtor@@@Z"
+// WIN32: %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty:<{ {}\*, %struct.SmallWithDtor }>]]* %{{.*}}, i32 0, i32 0
+// WIN32: %[[a1:[^ ]*]] = bitcast {}** %[[a]] to void [[dst_ty:\(%struct.ForwardDeclare1\*\)\*]]*
+// WIN32: %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
+// WIN32: %[[gep1:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 1
+// WIN32: %[[bc1:[^ ]*]] = bitcast %struct.SmallWithDtor* %[[gep1]] to i8*
+// WIN32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %[[bc1]], i8* {{.*}}, i32 4, i32 4, i1 false)
+// WIN32: %[[a2:[^ ]*]] = load void [[dst_ty]]* %[[a1]], align 4
+// WIN32: %[[gep2:[^ ]*]] = getelementptr inbounds [[argmem_ty]]* %[[argmem]], i32 0, i32 0
+// WIN32: %[[addr:[^ ]*]] = bitcast {}** %[[gep2]] to void [[dst_ty]]*
+// WIN32: store void [[dst_ty]] %[[a2]], void [[dst_ty]]* %[[addr]], align 4
+// WIN32: call void @"\01?fn1@@YAXP6AXUForwardDeclare1@@@ZUSmallWithDtor@@@Z"([[argmem_ty]]* inalloca %[[argmem]])
diff --git a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
index c0b9722..021356e 100644
--- a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
+++ b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
// CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()* }]
-// CHECK: [{ i32, void ()* } { i32 65535, void ()* @"\01??__Efoo@?$B@H@@YAXXZ" },
+// CHECK: [{ i32, void ()* } { i32 65535, void ()* @"\01??__Efoo@?$B@H@@2VA@@A@YAXXZ"
// CHECK: { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
struct S {
@@ -24,8 +24,8 @@
static S TheS;
}
// CHECK-LABEL: define void @"\01?StaticLocal@@YAXXZ"()
-// CHECK: load i32* @"\01?$S1@?1??StaticLocal@@YAXXZ@4IA"
-// CHECK: store i32 {{.*}}, i32* @"\01?$S1@?1??StaticLocal@@YAXXZ@4IA"
+// CHECK: load i32* @"\01?$S1@?0??StaticLocal@@YAXXZ@4IA"
+// CHECK: store i32 {{.*}}, i32* @"\01?$S1@?0??StaticLocal@@YAXXZ@4IA"
// CHECK: ret
void MultipleStatics() {
@@ -66,7 +66,7 @@
static S S35;
}
// CHECK-LABEL: define void @"\01?MultipleStatics@@YAXXZ"()
-// CHECK: load i32* @"\01?$S1@?1??MultipleStatics@@YAXXZ@4IA"
+// CHECK: load i32* @"\01?$S1@?0??MultipleStatics@@YAXXZ@4IA"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
@@ -74,7 +74,7 @@
// CHECK: and i32 {{.*}}, 16
// ...
// CHECK: and i32 {{.*}}, -2147483648
-// CHECK: load i32* @"\01?$S1@?1??MultipleStatics@@YAXXZ@4IA1"
+// CHECK: load i32* @"\01?$S1@?0??MultipleStatics@@YAXXZ@4IA1"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
@@ -134,16 +134,18 @@
(void)B<int>::foo; // (void) - force usage
}
-// CHECK: define internal void @"\01??__Efoo@?$B@H@@YAXXZ"() [[NUW]]
+// CHECK: define internal void @"\01??__Efoo@?$B@H@@2VA@@A@YAXXZ"() [[NUW]]
+// CHECK: load i32* @"\01??_Bfoo@?$B@H@@2VA@@A@5"
+// CHECK: store i32 {{.*}}, i32* @"\01??_Bfoo@?$B@H@@2VA@@A@5"
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"
-// CHECK: call i32 @atexit(void ()* @"\01??__Ffoo@?$B@H@@YAXXZ")
+// CHECK: call i32 @atexit(void ()* @"\01??__Ffoo@?$B@H@@2VA@@A@YAXXZ")
// CHECK: ret void
// CHECK: define linkonce_odr x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"
// CHECK: define linkonce_odr x86_thiscallcc void @"\01??1A@@QAE@XZ"
-// CHECK: define internal void @"\01??__Ffoo@?$B@H@@YAXXZ"
+// CHECK: define internal void @"\01??__Ffoo@?$B@H@@2VA@@A@YAXXZ"
// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"{{.*}}foo
// CHECK: ret void
diff --git a/test/CodeGenCXX/microsoft-abi-structors-alias.cpp b/test/CodeGenCXX/microsoft-abi-structors-alias.cpp
index d54520f..f977556 100644
--- a/test/CodeGenCXX/microsoft-abi-structors-alias.cpp
+++ b/test/CodeGenCXX/microsoft-abi-structors-alias.cpp
@@ -1,9 +1,26 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 -fno-rtti -mconstructor-aliases | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fno-rtti -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
namespace test1 {
template <typename T> class A {
~A() {}
};
template class A<char>;
-// CHECK: define weak_odr x86_thiscallcc void @"\01??1?$A@D@test1@@AAE@XZ"
+// CHECK-DAG: define weak_odr x86_thiscallcc void @"\01??1?$A@D@test1@@AAE@XZ"
+}
+
+namespace test2 {
+struct A {
+ virtual ~A();
+};
+struct B : A {
+ B();
+ virtual ~B();
+};
+
+A::~A() {}
+B::~B() {}
+void foo() {
+ B b;
+}
+// CHECK-DAG: @"\01??1B@test2@@UAE@XZ" = alias bitcast (void (%"struct.test2::A"*)* @"\01??1A@test2@@UAE@XZ" to void (%"struct.test2::B"*)*)
}
diff --git a/test/CodeGenCXX/microsoft-abi-structors.cpp b/test/CodeGenCXX/microsoft-abi-structors.cpp
index c2f1395..b79da8d 100644
--- a/test/CodeGenCXX/microsoft-abi-structors.cpp
+++ b/test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -cxx-abi microsoft -triple=i386-pc-win32 -fno-rtti > %t
+// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 -fno-rtti > %t
// RUN: FileCheck %s < %t
// vftables are emitted very late, so do another pass to try to keep the checks
// in source order.
// RUN: FileCheck --check-prefix DTORS %s < %t
+// RUN: FileCheck --check-prefix DTORS2 %s < %t
+// RUN: FileCheck --check-prefix DTORS3 %s < %t
//
-// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -cxx-abi microsoft -triple=x86_64-pc-win32 -fno-rtti | FileCheck --check-prefix DTORS-X64 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=x86_64-pc-win32 -fno-rtti | FileCheck --check-prefix DTORS-X64 %s
namespace basic {
@@ -121,6 +123,79 @@
} // end namespace basic
+namespace dtor_in_second_nvbase {
+
+struct A {
+ virtual void f(); // A needs vftable to be primary.
+};
+struct B {
+ virtual ~B();
+};
+struct C : A, B {
+ virtual ~C();
+};
+
+C::~C() {
+// CHECK-LABEL: define x86_thiscallcc void @"\01??1C@dtor_in_second_nvbase@@UAE@XZ"
+// CHECK: (%"struct.dtor_in_second_nvbase::C"* %this)
+// No this adjustment!
+// CHECK-NOT: getelementptr
+// CHECK: load %"struct.dtor_in_second_nvbase::C"** %{{.*}}
+// Now we this-adjust before calling ~B.
+// CHECK: bitcast %"struct.dtor_in_second_nvbase::C"* %{{.*}} to i8*
+// CHECK: getelementptr inbounds i8* %{{.*}}, i64 4
+// CHECK: bitcast i8* %{{.*}} to %"struct.dtor_in_second_nvbase::B"*
+// CHECK: call x86_thiscallcc void @"\01??1B@dtor_in_second_nvbase@@UAE@XZ"
+// CHECK: (%"struct.dtor_in_second_nvbase::B"* %{{.*}})
+// CHECK: ret void
+}
+
+void foo() {
+ C c;
+}
+// DTORS2-LABEL: define weak x86_thiscallcc void @"\01??_EC@dtor_in_second_nvbase@@W3AEPAXI@Z"
+// DTORS2: (%"struct.dtor_in_second_nvbase::C"* %this, i32 %should_call_delete)
+// Do an adjustment from B* to C*.
+// DTORS2: getelementptr i8* %{{.*}}, i32 -4
+// DTORS2: bitcast i8* %{{.*}} to %"struct.dtor_in_second_nvbase::C"*
+// DTORS2: call x86_thiscallcc void @"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z"
+// DTORS2: ret void
+
+}
+
+namespace test2 {
+// Just like dtor_in_second_nvbase, except put that in a vbase of a diamond.
+
+// C's dtor is in the non-primary base.
+struct A { virtual void f(); };
+struct B { virtual ~B(); };
+struct C : A, B { virtual ~C(); int c; };
+
+// Diamond hierarchy, with C as the shared vbase.
+struct D : virtual C { int d; };
+struct E : virtual C { int e; };
+struct F : D, E { ~F(); int f; };
+
+F::~F() {
+// CHECK-LABEL: define x86_thiscallcc void @"\01??1F@test2@@UAE@XZ"(%"struct.test2::F"*)
+// Do an adjustment from C vbase subobject to F as though F was the
+// complete type.
+// CHECK: getelementptr inbounds i8* %{{.*}}, i32 -20
+// CHECK: bitcast i8* %{{.*}} to %"struct.test2::F"*
+// CHECK: store %"struct.test2::F"*
+}
+
+void foo() {
+ F f;
+}
+// DTORS3-LABEL: define linkonce_odr x86_thiscallcc void @"\01??_DF@test2@@UAE@XZ"
+// Do an adjustment from C* to F*.
+// DTORS3: getelementptr i8* %{{.*}}, i32 20
+// DTORS3: bitcast i8* %{{.*}} to %"struct.test2::F"*
+// DTORS3: call x86_thiscallcc void @"\01??1F@test2@@UAE@XZ"
+// DTORS3: ret void
+
+}
namespace constructors {
@@ -299,3 +374,49 @@
}
}
+
+namespace test1 {
+struct A { };
+struct B : virtual A {
+ B(int *a);
+ B(const char *a, ...);
+ __cdecl B(short *a);
+};
+B::B(int *a) {}
+B::B(const char *a, ...) {}
+B::B(short *a) {}
+// CHECK: define x86_thiscallcc %"struct.test1::B"* @"\01??0B@test1@@QAE@PAH@Z"
+// CHECK: (%"struct.test1::B"* returned %this, i32* %a, i32 %is_most_derived)
+// CHECK: define %"struct.test1::B"* @"\01??0B@test1@@QAA@PBDZZ"
+// CHECK: (%"struct.test1::B"* returned %this, i32 %is_most_derived, i8* %a, ...)
+
+// FIXME: This should be x86_thiscallcc. MSVC ignores explicit CCs on structors.
+// CHECK: define %"struct.test1::B"* @"\01??0B@test1@@QAA@PAF@Z"
+// CHECK: (%"struct.test1::B"* returned %this, i16* %a, i32 %is_most_derived)
+
+void construct_b() {
+ int a;
+ B b1(&a);
+ B b2("%d %d", 1, 2);
+}
+// CHECK-LABEL: define void @"\01?construct_b@test1@@YAXXZ"()
+// CHECK: call x86_thiscallcc %"struct.test1::B"* @"\01??0B@test1@@QAE@PAH@Z"
+// CHECK: (%"struct.test1::B"* {{.*}}, i32* {{.*}}, i32 1)
+// CHECK: call %"struct.test1::B"* (%"struct.test1::B"*, i32, i8*, ...)* @"\01??0B@test1@@QAA@PBDZZ"
+// CHECK: (%"struct.test1::B"* {{.*}}, i32 1, i8* {{.*}}, i32 1, i32 2)
+}
+
+// Dtor thunks for classes in anonymous namespaces should be internal, not
+// linkonce_odr.
+namespace {
+struct A {
+ virtual ~A() { }
+};
+}
+void *getA() {
+ return (void*)new A();
+}
+// CHECK: define internal x86_thiscallcc void @"\01??_GA@?A@@UAEPAXI@Z"
+// CHECK: (%"struct.(anonymous namespace)::A"* %this, i32 %should_call_delete)
+// CHECK: define internal x86_thiscallcc void @"\01??1A@?A@@UAE@XZ"
+// CHECK: (%"struct.(anonymous namespace)::A"* %this)
diff --git a/test/CodeGenCXX/microsoft-abi-thunks.cpp b/test/CodeGenCXX/microsoft-abi-thunks.cpp
index f1bc385..2be642c 100644
--- a/test/CodeGenCXX/microsoft-abi-thunks.cpp
+++ b/test/CodeGenCXX/microsoft-abi-thunks.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 >%t 2>&1
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -triple=i386-pc-win32 >%t 2>&1
// RUN: FileCheck --check-prefix=MANGLING %s < %t
// RUN: FileCheck --check-prefix=XMANGLING %s < %t
// RUN: FileCheck --check-prefix=CODEGEN %s < %t
-// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 2>&1 | FileCheck --check-prefix=MANGLING-X64 %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -triple=x86_64-pc-win32 2>&1 | FileCheck --check-prefix=MANGLING-X64 %s
void foo(void *);
diff --git a/test/CodeGenCXX/microsoft-abi-vbtables.cpp b/test/CodeGenCXX/microsoft-abi-vbtables.cpp
index 6de556b..b950d0c 100644
--- a/test/CodeGenCXX/microsoft-abi-vbtables.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vbtables.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=i386-pc-win32 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o - | FileCheck %s
// See microsoft-abi-structors.cpp for constructor codegen tests.
@@ -477,3 +477,44 @@
// CHECK-DAG: @"\01??_8F@Test26@@7BD@1@@" = linkonce_odr unnamed_addr constant [4 x i32] [i32 0, i32 16, i32 12, i32 20]
// CHECK-DAG: @"\01??_8F@Test26@@7BE@1@@" = linkonce_odr unnamed_addr constant [2 x i32] [i32 -4, i32 28]
}
+
+namespace Test27 {
+// PR17748
+struct A {};
+struct B : virtual A {};
+struct C : virtual B {};
+struct D : C, B {};
+struct E : D {};
+struct F : C, E {};
+struct G : F, D, C, B {};
+G x;
+
+// CHECK-DAG: @"\01??_8G@Test27@@7BB@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BB@1@F@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@D@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@E@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@F@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BD@1@@" =
+// CHECK-DAG: @"\01??_8G@Test27@@7BF@1@@" =
+}
+
+namespace Test28 {
+// PR17748
+struct A {};
+struct B : virtual A {};
+struct C : virtual B {};
+struct D : C, B {};
+struct E : C, D {};
+struct F : virtual E, virtual D, virtual C {};
+F x;
+
+// CHECK-DAG: @"\01??_8F@Test28@@7B01@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BB@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@D@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@D@1@E@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@E@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BD@1@@" =
+// CHECK-DAG: @"\01??_8F@Test28@@7BE@1@@" =
+}
diff --git a/test/CodeGenCXX/microsoft-abi-virtual-inheritance-vtordisps.cpp b/test/CodeGenCXX/microsoft-abi-virtual-inheritance-vtordisps.cpp
index 8e23ade..5d11896 100644
--- a/test/CodeGenCXX/microsoft-abi-virtual-inheritance-vtordisps.cpp
+++ b/test/CodeGenCXX/microsoft-abi-virtual-inheritance-vtordisps.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=i386-pc-win32 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o - | FileCheck %s
// For now, just make sure x86_64 doesn't crash.
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=x86_64-pc-win32 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -fno-rtti -triple=x86_64-pc-win32 -emit-llvm -o %t
struct A {
virtual void f();
diff --git a/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
index 7c223ca..2f0fffee 100644
--- a/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=i386-pc-win32 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o %t
// RUN: FileCheck %s < %t
// RUN: FileCheck --check-prefix=CHECK2 %s < %t
// For now, just make sure x86_64 doesn't crash.
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=x86_64-pc-win32 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -fno-rtti -triple=x86_64-pc-win32 -emit-llvm -o %t
struct VBase {
virtual ~VBase();
@@ -312,3 +312,151 @@
}
}
+
+namespace test2 {
+struct A { A(); };
+struct B : virtual A { B() {} };
+struct C : B, A { C() {} };
+
+// PR18435: Order mattered here. We were generating code for the delegating
+// call to B() from C().
+void callC() { C x; }
+
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc %"struct.test2::C"* @"\01??0C@test2@@QAE@XZ"
+// CHECK: (%"struct.test2::C"* returned %this, i32 %is_most_derived)
+// CHECK: br i1
+// Virtual bases
+// CHECK: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}})
+// CHECK: br label
+// Non-virtual bases
+// CHECK: call x86_thiscallcc %"struct.test2::B"* @"\01??0B@test2@@QAE@XZ"(%"struct.test2::B"* %{{.*}}, i32 0)
+// CHECK: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}})
+// CHECK: ret
+
+// CHECK2-LABEL: define linkonce_odr x86_thiscallcc %"struct.test2::B"* @"\01??0B@test2@@QAE@XZ"
+// CHECK2: (%"struct.test2::B"* returned %this, i32 %is_most_derived)
+// CHECK2: call x86_thiscallcc %"struct.test2::A"* @"\01??0A@test2@@QAE@XZ"(%"struct.test2::A"* %{{.*}})
+// CHECK2: ret
+
+}
+
+namespace test3 {
+// PR19104: A non-virtual call of a virtual method doesn't use vftable thunks,
+// so requires only static adjustment which is different to the one used
+// for virtual calls.
+struct A {
+ virtual void foo();
+};
+
+struct B : virtual A {
+ virtual void bar();
+};
+
+struct C : virtual A {
+ virtual void foo();
+};
+
+struct D : B, C {
+ virtual void bar();
+ int field; // Laid out between C and A subobjects in D.
+};
+
+void D::bar() {
+ // CHECK-LABEL: define x86_thiscallcc void @"\01?bar@D@test3@@UAEXXZ"(%"struct.test3::D"* %this)
+
+ C::foo();
+ // Shouldn't need any vbtable lookups. All we have to do is adjust to C*,
+ // then compensate for the adjustment performed in the C::foo() prologue.
+ // CHECK-NOT: load i8**
+ // CHECK: %[[OBJ_i8:.*]] = bitcast %"struct.test3::D"* %{{.*}} to i8*
+ // CHECK: %[[C_i8:.*]] = getelementptr inbounds i8* %[[OBJ_i8]], i32 8
+ // CHECK: %[[C:.*]] = bitcast i8* %[[C_i8]] to %"struct.test3::C"*
+ // CHECK: %[[C_i8:.*]] = bitcast %"struct.test3::C"* %[[C]] to i8*
+ // CHECK: %[[ARG:.*]] = getelementptr i8* %[[C_i8]], i32 4
+ // CHECK: call x86_thiscallcc void @"\01?foo@C@test3@@UAEXXZ"(i8* %[[ARG]])
+ // CHECK: ret
+}
+}
+
+namespace test4{
+// PR19172: We used to merge method vftable locations wrong.
+
+struct A {
+ virtual ~A() {}
+};
+
+struct B {
+ virtual ~B() {}
+};
+
+struct C : virtual A, B {
+ virtual ~C();
+};
+
+void foo(void*);
+
+C::~C() {
+ // CHECK-LABEL: define x86_thiscallcc void @"\01??1C@test4@@UAE@XZ"(%"struct.test4::C"* %this)
+
+ // In this case "this" points to the most derived class, so no GEPs needed.
+ // CHECK-NOT: getelementptr
+ // CHECK-NOT: bitcast
+ // CHECK: %[[VFPTR_i8:.*]] = bitcast %"struct.test4::C"* %{{.*}} to [1 x i8*]**
+ // CHECK: store [1 x i8*]* @"\01??_7C@test4@@6BB@1@@", [1 x i8*]** %[[VFPTR_i8]]
+
+ foo(this);
+ // CHECK: ret
+}
+
+void destroy(C *obj) {
+ // CHECK-LABEL: define void @"\01?destroy@test4@@YAXPAUC@1@@Z"(%"struct.test4::C"* %obj)
+
+ delete obj;
+ // CHECK: %[[VPTR:.*]] = bitcast %"struct.test4::C"* %[[OBJ:.*]] to void (%"struct.test4::C"*, i32)***
+ // CHECK: %[[VFTABLE:.*]] = load void (%"struct.test4::C"*, i32)*** %[[VPTR]]
+ // CHECK: %[[VFTENTRY:.*]] = getelementptr inbounds void (%"struct.test4::C"*, i32)** %[[VFTABLE]], i64 0
+ // CHECK: %[[VFUN:.*]] = load void (%"struct.test4::C"*, i32)** %[[VFTENTRY]]
+ // CHECK: call x86_thiscallcc void %[[VFUN]](%"struct.test4::C"* %[[OBJ]], i32 1)
+ // CHECK: ret
+}
+
+struct D {
+ virtual void d();
+};
+
+// The first non-virtual base doesn't have a vdtor,
+// but "this adjustment" is not needed.
+struct E : D, B, virtual A {
+ virtual ~E();
+};
+
+E::~E() {
+ // CHECK-LABEL: define x86_thiscallcc void @"\01??1E@test4@@UAE@XZ"(%"struct.test4::E"* %this)
+
+ // In this case "this" points to the most derived class, so no GEPs needed.
+ // CHECK-NOT: getelementptr
+ // CHECK-NOT: bitcast
+ // CHECK: %[[VFPTR_i8:.*]] = bitcast %"struct.test4::E"* %{{.*}} to [1 x i8*]**
+ // CHECK: store [1 x i8*]* @"\01??_7E@test4@@6BD@1@@", [1 x i8*]** %[[VFPTR_i8]]
+ foo(this);
+}
+
+void destroy(E *obj) {
+ // CHECK-LABEL: define void @"\01?destroy@test4@@YAXPAUE@1@@Z"(%"struct.test4::E"* %obj)
+
+ // CHECK-NOT: getelementptr
+ // CHECK: %[[OBJ_i8:.*]] = bitcast %"struct.test4::E"* %[[OBJ:.*]] to i8*
+ // CHECK: %[[B_i8:.*]] = getelementptr inbounds i8* %[[OBJ_i8]], i32 4
+ // CHECK: %[[VPTR:.*]] = bitcast i8* %[[B_i8]] to void (%"struct.test4::E"*, i32)***
+ // CHECK: %[[VFTABLE:.*]] = load void (%"struct.test4::E"*, i32)*** %[[VPTR]]
+ // CHECK: %[[VFTENTRY:.*]] = getelementptr inbounds void (%"struct.test4::E"*, i32)** %[[VFTABLE]], i64 0
+ // CHECK: %[[VFUN:.*]] = load void (%"struct.test4::E"*, i32)** %[[VFTENTRY]]
+ // CHECK: %[[OBJ_i8:.*]] = bitcast %"struct.test4::E"* %[[OBJ]] to i8*
+ // CHECK: %[[B_i8:.*]] = getelementptr inbounds i8* %[[OBJ_i8]], i32 4
+ // FIXME: in fact, the call should take i8* and the bitcast is redundant.
+ // CHECK: %[[B_as_E:.*]] = bitcast i8* %[[B_i8]] to %"struct.test4::E"*
+ // CHECK: call x86_thiscallcc void %[[VFUN]](%"struct.test4::E"* %[[B_as_E]], i32 1)
+ delete obj;
+}
+
+}
diff --git a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
index 51a04c8..1546e6c 100644
--- a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
+++ b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK32
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK64
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK32
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK64
struct S {
int x, y, z;
@@ -35,14 +35,14 @@
// CHECK32: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA@AE" to i8*), i8** %ptr
// CHECK32: store i8* bitcast (i32 (%struct.C*, i32, double)* @"\01??_9C@@$B3AE" to i8*), i8** %ptr2
// CHECK32: store i8* bitcast (void (%struct.S*, %struct.C*, i32)* @"\01??_9C@@$B7AE" to i8*), i8** %ptr3
-// CHECK32: store i8* bitcast (void (%"struct.<anonymous namespace>::D"*)* @"\01??_9D@?A@@$BA@AE" to i8*), i8** %ptr4
+// CHECK32: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA@AE" to i8*), i8** %ptr4
// CHECK32: }
//
// CHECK64-LABEL: define void @"\01?f@@YAXXZ"()
// CHECK64: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA@AA" to i8*), i8** %ptr
// CHECK64: store i8* bitcast (i32 (%struct.C*, i32, double)* @"\01??_9C@@$B7AA" to i8*), i8** %ptr2
// CHECK64: store i8* bitcast (void (%struct.S*, %struct.C*, i32)* @"\01??_9C@@$BBA@AA" to i8*), i8** %ptr3
-// CHECK64: store i8* bitcast (void (%"struct.<anonymous namespace>::D"*)* @"\01??_9D@?A@@$BA@AA" to i8*), i8** %ptr
+// CHECK64: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA@AA" to i8*), i8** %ptr
// CHECK64: }
}
@@ -93,16 +93,16 @@
// CHECK64: }
// Thunk for calling the virtual function in internal class D.
-// CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA@AE"(%"struct.<anonymous namespace>::D"* %this) unnamed_addr
-// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.<anonymous namespace>::D"*)** %{{.*}}, i64 0
-// CHECK32: [[CALLEE:%.*]] = load void (%"struct.<anonymous namespace>::D"*)** [[VPTR]]
-// CHECK32: call x86_thiscallcc void [[CALLEE]](%"struct.<anonymous namespace>::D"* %{{.*}})
+// CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA@AE"(%"struct.(anonymous namespace)::D"* %this) unnamed_addr
+// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*)** %{{.*}}, i64 0
+// CHECK32: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*)** [[VPTR]]
+// CHECK32: call x86_thiscallcc void [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}})
// CHECK32: ret void
// CHECK32: }
//
-// CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA@AA"(%"struct.<anonymous namespace>::D"* %this) unnamed_addr
-// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.<anonymous namespace>::D"*)** %{{.*}}, i64 0
-// CHECK64: [[CALLEE:%.*]] = load void (%"struct.<anonymous namespace>::D"*)** [[VPTR]]
-// CHECK64: call void [[CALLEE]](%"struct.<anonymous namespace>::D"* %{{.*}})
+// CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA@AA"(%"struct.(anonymous namespace)::D"* %this) unnamed_addr
+// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*)** %{{.*}}, i64 0
+// CHECK64: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*)** [[VPTR]]
+// CHECK64: call void [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}})
// CHECK64: ret void
// CHECK64: }
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance.cpp
index d93dee1..39f2079 100644
--- a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance.cpp
@@ -1,29 +1,5 @@
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=i386-pc-win32 -emit-llvm -o %t.ll -fdump-vtable-layouts >%t
-
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test1 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test2 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test3 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test4 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test5 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test6 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test7 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test8 %s < %t
-// RUN: FileCheck --check-prefix=NO-THUNKS-Test9 %s < %t
-// RUN: FileCheck --check-prefix=PURE-VIRTUAL-Test1 %s < %t
-// RUN: FileCheck --check-prefix=THIS-THUNKS-Test1 %s < %t
-// RUN: FileCheck --check-prefix=THIS-THUNKS-Test2 %s < %t
-// RUN: FileCheck --check-prefix=THIS-THUNKS-Test3 %s < %t
-// RUN: FileCheck --check-prefix=VDTOR-THUNKS-Test3 %s < %t
-// RUN: FileCheck --check-prefix=VDTOR-THUNKS-Test5 %s < %t
-// RUN: FileCheck --check-prefix=VDTOR-THUNKS-Test6 %s < %t
-// RUN: FileCheck --check-prefix=VDTOR-THUNKS-Test7 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test1 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test2 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test3 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test4 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test5 %s < %t
-// RUN: FileCheck --check-prefix=RET-THUNKS-Test6 %s < %t
-
+// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o %t.ll -fdump-vtable-layouts >%t
+// RUN: FileCheck %s < %t
// RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
struct Empty {
@@ -48,15 +24,15 @@
namespace no_thunks {
struct Test1: A, B {
- // NO-THUNKS-Test1: VFTable for 'A' in 'no_thunks::Test1' (1 entries)
- // NO-THUNKS-Test1-NEXT: 0 | void no_thunks::Test1::f()
+ // CHECK-LABEL:Test1' (1 entry)
+ // CHECK-NEXT: 0 | void no_thunks::Test1::f()
- // NO-THUNKS-Test1: VFTable for 'B' in 'no_thunks::Test1' (2 entries)
- // NO-THUNKS-Test1-NEXT: 0 | void B::g()
- // NO-THUNKS-Test1-NEXT: 1 | void B::h()
+ // CHECK-LABEL:Test1' (2 entries)
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test1: VFTable indices for 'no_thunks::Test1' (1 entries)
- // NO-THUNKS-Test1-NEXT: 0 | void no_thunks::Test1::f()
+ // CHECK-LABEL:Test1' (1 entry)
+ // CHECK-NEXT: 0 | void no_thunks::Test1::f()
// MANGLING-DAG: @"\01??_7Test1@no_thunks@@6BA@@@"
// MANGLING-DAG: @"\01??_7Test1@no_thunks@@6BB@@@"
@@ -66,18 +42,19 @@
};
Test1 t1;
+void use(Test1 *obj) { obj->f(); }
struct Test2: A, B {
- // NO-THUNKS-Test2: VFTable for 'A' in 'no_thunks::Test2' (1 entries)
- // NO-THUNKS-Test2-NEXT: 0 | void A::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test2' (1 entry)
+ // CHECK-NEXT: 0 | void A::f()
- // NO-THUNKS-Test2: VFTable for 'B' in 'no_thunks::Test2' (2 entries)
- // NO-THUNKS-Test2-NEXT: 0 | void no_thunks::Test2::g()
- // NO-THUNKS-Test2-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test2' (2 entries)
+ // CHECK-NEXT: 0 | void no_thunks::Test2::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test2: VFTable indices for 'no_thunks::Test2' (1 entries).
- // NO-THUNKS-Test2-NEXT: via vfptr at offset 4
- // NO-THUNKS-Test2-NEXT: 0 | void no_thunks::Test2::g()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test2' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void no_thunks::Test2::g()
// Overrides only the right child's method (B::g), needs this adjustment but
// not thunks.
@@ -85,32 +62,34 @@
};
Test2 t2;
+void use(Test2 *obj) { obj->g(); }
struct Test3: A, B {
- // NO-THUNKS-Test3: VFTable for 'A' in 'no_thunks::Test3' (2 entries)
- // NO-THUNKS-Test3-NEXT: 0 | void A::f()
- // NO-THUNKS-Test3-NEXT: 1 | void no_thunks::Test3::i()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test3' (2 entries)
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void no_thunks::Test3::i()
- // NO-THUNKS-Test3: VFTable for 'B' in 'no_thunks::Test3' (2 entries)
- // NO-THUNKS-Test3-NEXT: 0 | void B::g()
- // NO-THUNKS-Test3-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test3' (2 entries)
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test3: VFTable indices for 'no_thunks::Test3' (1 entries).
- // NO-THUNKS-Test3-NEXT: 1 | void no_thunks::Test3::i()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test3' (1 entry).
+ // CHECK-NEXT: 1 | void no_thunks::Test3::i()
// Only adds a new method.
virtual void i();
};
Test3 t3;
+void use(Test3 *obj) { obj->i(); }
// Only the right base has a vftable, so it's laid out before the left one!
struct Test4 : Empty, A {
- // NO-THUNKS-Test4: VFTable for 'A' in 'no_thunks::Test4' (1 entries)
- // NO-THUNKS-Test4-NEXT: 0 | void no_thunks::Test4::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test4' (1 entry)
+ // CHECK-NEXT: 0 | void no_thunks::Test4::f()
- // NO-THUNKS-Test4: VFTable indices for 'no_thunks::Test4' (1 entries).
- // NO-THUNKS-Test4-NEXT: 0 | void no_thunks::Test4::f()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test4' (1 entry).
+ // CHECK-NEXT: 0 | void no_thunks::Test4::f()
// MANGLING-DAG: @"\01??_7Test4@no_thunks@@6B@"
@@ -118,26 +97,27 @@
};
Test4 t4;
+void use(Test4 *obj) { obj->f(); }
// 2-level structure with repeating subobject types, but no thunks needed.
struct Test5: Test1, Test2 {
- // NO-THUNKS-Test5: VFTable for 'A' in 'no_thunks::Test1' in 'no_thunks::Test5' (2 entries)
- // NO-THUNKS-Test5-NEXT: 0 | void no_thunks::Test1::f()
- // NO-THUNKS-Test5-NEXT: 1 | void no_thunks::Test5::z()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test1' in 'no_thunks::Test5' (2 entries)
+ // CHECK-NEXT: 0 | void no_thunks::Test1::f()
+ // CHECK-NEXT: 1 | void no_thunks::Test5::z()
- // NO-THUNKS-Test5: VFTable for 'B' in 'no_thunks::Test1' in 'no_thunks::Test5' (2 entries)
- // NO-THUNKS-Test5-NEXT: 0 | void B::g()
- // NO-THUNKS-Test5-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test1' in 'no_thunks::Test5' (2 entries)
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test5: VFTable for 'A' in 'no_thunks::Test2' in 'no_thunks::Test5' (1 entries)
- // NO-THUNKS-Test5-NEXT: 0 | void A::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test2' in 'no_thunks::Test5' (1 entry)
+ // CHECK-NEXT: 0 | void A::f()
- // NO-THUNKS-Test5: VFTable for 'B' in 'no_thunks::Test2' in 'no_thunks::Test5' (2 entries)
- // NO-THUNKS-Test5-NEXT: 0 | void no_thunks::Test2::g()
- // NO-THUNKS-Test5-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test2' in 'no_thunks::Test5' (2 entries)
+ // CHECK-NEXT: 0 | void no_thunks::Test2::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test5: VFTable indices for 'no_thunks::Test5' (1 entries).
- // NO-THUNKS-Test5-NEXT: 1 | void no_thunks::Test5::z()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test5' (1 entry).
+ // CHECK-NEXT: 1 | void no_thunks::Test5::z()
// MANGLING-DAG: @"\01??_7Test5@no_thunks@@6BA@@Test1@1@@"
// MANGLING-DAG: @"\01??_7Test5@no_thunks@@6BA@@Test2@1@@"
@@ -148,17 +128,18 @@
};
Test5 t5;
+void use(Test5 *obj) { obj->z(); }
struct Test6: Test1 {
- // NO-THUNKS-Test6: VFTable for 'A' in 'no_thunks::Test1' in 'no_thunks::Test6' (1 entries).
- // NO-THUNKS-Test6-NEXT: 0 | void no_thunks::Test6::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test1' in 'no_thunks::Test6' (1 entry).
+ // CHECK-NEXT: 0 | void no_thunks::Test6::f()
- // NO-THUNKS-Test6: VFTable for 'B' in 'no_thunks::Test1' in 'no_thunks::Test6' (2 entries).
- // NO-THUNKS-Test6-NEXT: 0 | void B::g()
- // NO-THUNKS-Test6-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test1' in 'no_thunks::Test6' (2 entries).
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test6: VFTable indices for 'no_thunks::Test6' (1 entries).
- // NO-THUNKS-Test6-NEXT: 0 | void no_thunks::Test6::f()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test6' (1 entry).
+ // CHECK-NEXT: 0 | void no_thunks::Test6::f()
// MANGLING-DAG: @"\01??_7Test6@no_thunks@@6BA@@@"
// MANGLING-DAG: @"\01??_7Test6@no_thunks@@6BB@@@"
@@ -168,43 +149,46 @@
};
Test6 t6;
+void use(Test6 *obj) { obj->f(); }
struct Test7: Test2 {
- // NO-THUNKS-Test7: VFTable for 'A' in 'no_thunks::Test2' in 'no_thunks::Test7' (1 entries).
- // NO-THUNKS-Test7-NEXT: 0 | void A::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test2' in 'no_thunks::Test7' (1 entry).
+ // CHECK-NEXT: 0 | void A::f()
- // NO-THUNKS-Test7: VFTable for 'B' in 'no_thunks::Test2' in 'no_thunks::Test7' (2 entries).
- // NO-THUNKS-Test7-NEXT: 0 | void no_thunks::Test7::g()
- // NO-THUNKS-Test7-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test2' in 'no_thunks::Test7' (2 entries).
+ // CHECK-NEXT: 0 | void no_thunks::Test7::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test7: VFTable indices for 'no_thunks::Test7' (1 entries).
- // NO-THUNKS-Test7-NEXT: via vfptr at offset 4
- // NO-THUNKS-Test7-NEXT: 0 | void no_thunks::Test7::g()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test7' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void no_thunks::Test7::g()
// Overrides both no_thunks::Test2::g and B::g.
virtual void g();
};
Test7 t7;
+void use(Test7 *obj) { obj->g(); }
struct Test8: Test3 {
- // NO-THUNKS-Test8: VFTable for 'A' in 'no_thunks::Test3' in 'no_thunks::Test8' (2 entries).
- // NO-THUNKS-Test8-NEXT: 0 | void A::f()
- // NO-THUNKS-Test8-NEXT: 1 | void no_thunks::Test3::i()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test3' in 'no_thunks::Test8' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void no_thunks::Test3::i()
- // NO-THUNKS-Test8: VFTable for 'B' in 'no_thunks::Test3' in 'no_thunks::Test8' (2 entries).
- // NO-THUNKS-Test8-NEXT: 0 | void no_thunks::Test8::g()
- // NO-THUNKS-Test8-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test3' in 'no_thunks::Test8' (2 entries).
+ // CHECK-NEXT: 0 | void no_thunks::Test8::g()
+ // CHECK-NEXT: 1 | void B::h()
- // NO-THUNKS-Test8: VFTable indices for 'no_thunks::Test8' (1 entries).
- // NO-THUNKS-Test8-NEXT: via vfptr at offset 4
- // NO-THUNKS-Test8-NEXT: 0 | void no_thunks::Test8::g()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test8' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void no_thunks::Test8::g()
// Overrides grandparent's B::g.
virtual void g();
};
Test8 t8;
+void use(Test8 *obj) { obj->g(); }
struct D : A {
virtual void g();
@@ -212,16 +196,16 @@
// Repeating subobject.
struct Test9: A, D {
- // NO-THUNKS-Test9: VFTable for 'A' in 'no_thunks::Test9' (2 entries).
- // NO-THUNKS-Test9-NEXT: 0 | void A::f()
- // NO-THUNKS-Test9-NEXT: 1 | void no_thunks::Test9::h()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test9' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void no_thunks::Test9::h()
- // NO-THUNKS-Test9: VFTable for 'A' in 'no_thunks::D' in 'no_thunks::Test9' (2 entries).
- // NO-THUNKS-Test9-NEXT: 0 | void A::f()
- // NO-THUNKS-Test9-NEXT: 1 | void no_thunks::D::g()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::D' in 'no_thunks::Test9' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void no_thunks::D::g()
- // NO-THUNKS-Test9: VFTable indices for 'no_thunks::Test9' (1 entries).
- // NO-THUNKS-Test9-NEXT: 1 | void no_thunks::Test9::h()
+ // CHECK-LABEL: VFTable indices for 'no_thunks::Test9' (1 entry).
+ // CHECK-NEXT: 1 | void no_thunks::Test9::h()
// MANGLING-DAG: @"\01??_7Test9@no_thunks@@6BA@@@"
// MANGLING-DAG: @"\01??_7Test9@no_thunks@@6BD@1@@"
@@ -230,6 +214,7 @@
};
Test9 t9;
+void use(Test9 *obj) { obj->h(); }
}
namespace pure_virtual {
@@ -240,16 +225,16 @@
struct Test1: A, D {
- // PURE-VIRTUAL-Test1: VFTable for 'A' in 'pure_virtual::Test1' (1 entries)
- // PURE-VIRTUAL-Test1-NEXT: 0 | void A::f()
+ // CHECK: VFTable for 'A' in 'pure_virtual::Test1' (1 entry)
+ // CHECK-NEXT: 0 | void A::f()
- // PURE-VIRTUAL-Test1: VFTable for 'pure_virtual::D' in 'pure_virtual::Test1' (2 entries)
- // PURE-VIRTUAL-Test1-NEXT: 0 | void pure_virtual::Test1::g()
- // PURE-VIRTUAL-Test1-NEXT: 1 | void pure_virtual::D::h()
+ // CHECK: VFTable for 'pure_virtual::D' in 'pure_virtual::Test1' (2 entries)
+ // CHECK-NEXT: 0 | void pure_virtual::Test1::g()
+ // CHECK-NEXT: 1 | void pure_virtual::D::h()
- // PURE-VIRTUAL-Test1: VFTable indices for 'pure_virtual::Test1' (1 entries).
- // PURE-VIRTUAL-Test1-NEXT: via vfptr at offset 4
- // PURE-VIRTUAL-Test1-NEXT: 0 | void pure_virtual::Test1::g()
+ // CHECK: VFTable indices for 'pure_virtual::Test1' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void pure_virtual::Test1::g()
// MANGLING-DAG: @"\01??_7Test1@pure_virtual@@6BA@@@"
// MANGLING-DAG: @"\01??_7Test1@pure_virtual@@6BD@1@@"
@@ -260,25 +245,26 @@
};
Test1 t1;
+void use(Test1 *obj) { obj->g(); }
}
namespace this_adjustment {
// Overrides methods of two bases at the same time, thus needing thunks.
struct Test1 : B, C {
- // THIS-THUNKS-Test1: VFTable for 'B' in 'this_adjustment::Test1' (2 entries).
- // THIS-THUNKS-Test1-NEXT: 0 | void this_adjustment::Test1::g()
- // THIS-THUNKS-Test1-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'this_adjustment::Test1' (2 entries).
+ // CHECK-NEXT: 0 | void this_adjustment::Test1::g()
+ // CHECK-NEXT: 1 | void B::h()
- // THIS-THUNKS-Test1: VFTable for 'C' in 'this_adjustment::Test1' (1 entries).
- // THIS-THUNKS-Test1-NEXT: 0 | void this_adjustment::Test1::g()
- // THIS-THUNKS-Test1-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'C' in 'this_adjustment::Test1' (1 entry).
+ // CHECK-NEXT: 0 | void this_adjustment::Test1::g()
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // THIS-THUNKS-Test1: Thunks for 'void this_adjustment::Test1::g()' (1 entry).
- // THIS-THUNKS-Test1-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'void this_adjustment::Test1::g()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // THIS-THUNKS-Test1: VFTable indices for 'this_adjustment::Test1' (1 entries).
- // THIS-THUNKS-Test1-NEXT: 0 | void this_adjustment::Test1::g()
+ // CHECK-LABEL: VFTable indices for 'this_adjustment::Test1' (1 entry).
+ // CHECK-NEXT: 0 | void this_adjustment::Test1::g()
// MANGLING-DAG: @"\01??_7Test1@this_adjustment@@6BB@@@"
// MANGLING-DAG: @"\01??_7Test1@this_adjustment@@6BC@@@"
@@ -287,25 +273,26 @@
};
Test1 t1;
+void use(Test1 *obj) { obj->g(); }
struct Test2 : A, B, C {
- // THIS-THUNKS-Test2: VFTable for 'A' in 'this_adjustment::Test2' (1 entries).
- // THIS-THUNKS-Test2-NEXT: 0 | void A::f()
+ // CHECK-LABEL: VFTable for 'A' in 'this_adjustment::Test2' (1 entry).
+ // CHECK-NEXT: 0 | void A::f()
- // THIS-THUNKS-Test2: VFTable for 'B' in 'this_adjustment::Test2' (2 entries).
- // THIS-THUNKS-Test2-NEXT: 0 | void this_adjustment::Test2::g()
- // THIS-THUNKS-Test2-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'this_adjustment::Test2' (2 entries).
+ // CHECK-NEXT: 0 | void this_adjustment::Test2::g()
+ // CHECK-NEXT: 1 | void B::h()
- // THIS-THUNKS-Test2: VFTable for 'C' in 'this_adjustment::Test2' (1 entries).
- // THIS-THUNKS-Test2-NEXT: 0 | void this_adjustment::Test2::g()
- // THIS-THUNKS-Test2-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'C' in 'this_adjustment::Test2' (1 entry).
+ // CHECK-NEXT: 0 | void this_adjustment::Test2::g()
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // THIS-THUNKS-Test2: Thunks for 'void this_adjustment::Test2::g()' (1 entry).
- // THIS-THUNKS-Test2-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'void this_adjustment::Test2::g()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // THIS-THUNKS-Test2: VFTable indices for 'this_adjustment::Test2' (1 entries).
- // THIS-THUNKS-Test2-NEXT: via vfptr at offset 4
- // THIS-THUNKS-Test2-NEXT: 0 | void this_adjustment::Test2::g()
+ // CHECK-LABEL: VFTable indices for 'this_adjustment::Test2' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void this_adjustment::Test2::g()
// MANGLING-DAG: @"\01??_7Test2@this_adjustment@@6BA@@@"
// MANGLING-DAG: @"\01??_7Test2@this_adjustment@@6BB@@@"
@@ -315,42 +302,44 @@
};
Test2 t2;
+void use(Test2 *obj) { obj->g(); }
// Overrides methods of two bases at the same time, thus needing thunks.
struct Test3: no_thunks::Test1, no_thunks::Test2 {
- // THIS-THUNKS-Test3: VFTable for 'A' in 'no_thunks::Test1' in 'this_adjustment::Test3' (1 entries).
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::f()
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test1' in 'this_adjustment::Test3' (1 entry).
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::f()
- // THIS-THUNKS-Test3: VFTable for 'B' in 'no_thunks::Test1' in 'this_adjustment::Test3' (2 entries).
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::g()
- // THIS-THUNKS-Test3-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test1' in 'this_adjustment::Test3' (2 entries).
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::g()
+ // CHECK-NEXT: 1 | void B::h()
- // THIS-THUNKS-Test3: VFTable for 'A' in 'no_thunks::Test2' in 'this_adjustment::Test3' (1 entries).
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::f()
- // THIS-THUNKS-Test3-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: VFTable for 'A' in 'no_thunks::Test2' in 'this_adjustment::Test3' (1 entry).
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::f()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
- // THIS-THUNKS-Test3: Thunks for 'void this_adjustment::Test3::f()' (1 entry).
- // THIS-THUNKS-Test3-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void this_adjustment::Test3::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // THIS-THUNKS-Test3: VFTable for 'B' in 'no_thunks::Test2' in 'this_adjustment::Test3' (2 entries).
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::g()
- // THIS-THUNKS-Test3-NEXT: [this adjustment: -8 non-virtual]
- // THIS-THUNKS-Test3-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'no_thunks::Test2' in 'this_adjustment::Test3' (2 entries).
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::g()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-NEXT: 1 | void B::h()
- // THIS-THUNKS-Test3: Thunks for 'void this_adjustment::Test3::g()' (1 entry).
- // THIS-THUNKS-Test3-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void this_adjustment::Test3::g()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // THIS-THUNKS-Test3: VFTable indices for 'this_adjustment::Test3' (2 entries).
- // THIS-THUNKS-Test3-NEXT: via vfptr at offset 0
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::f()
- // THIS-THUNKS-Test3-NEXT: via vfptr at offset 4
- // THIS-THUNKS-Test3-NEXT: 0 | void this_adjustment::Test3::g()
+ // CHECK-LABEL: VFTable indices for 'this_adjustment::Test3' (2 entries).
+ // CHECK-NEXT: via vfptr at offset 0
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::f()
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 0 | void this_adjustment::Test3::g()
virtual void f();
virtual void g();
};
Test3 t3;
+void use(Test3 *obj) { obj->g(); }
}
namespace vdtor {
@@ -364,23 +353,24 @@
};
struct Test3 : Test1, Test2 {
- // VDTOR-THUNKS-Test3: VFTable for 'vdtor::Test1' in 'vdtor::Test3' (2 entries).
- // VDTOR-THUNKS-Test3-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
- // VDTOR-THUNKS-Test3-NEXT: 1 | void vdtor::Test1::z1()
+ // CHECK-LABEL: VFTable for 'vdtor::Test1' in 'vdtor::Test3' (2 entries).
+ // CHECK-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
+ // CHECK-NEXT: 1 | void vdtor::Test1::z1()
- // VDTOR-THUNKS-Test3: VFTable for 'vdtor::Test2' in 'vdtor::Test3' (1 entries).
- // VDTOR-THUNKS-Test3-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
- // VDTOR-THUNKS-Test3-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'vdtor::Test2' in 'vdtor::Test3' (1 entry).
+ // CHECK-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test3: Thunks for 'vdtor::Test3::~Test3()' (1 entry).
- // VDTOR-THUNKS-Test3-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtor::Test3::~Test3()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test3: VFTable indices for 'vdtor::Test3' (1 entries).
- // VDTOR-THUNKS-Test3-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtor::Test3' (1 entry).
+ // CHECK-NEXT: 0 | vdtor::Test3::~Test3() [scalar deleting]
virtual ~Test3();
};
Test3 t3;
+void use(Test3 *obj) { delete obj; }
struct Test4 {
// No virtual destructor here!
@@ -390,61 +380,64 @@
struct Test5 : Test4, Test2 {
// Implicit virtual dtor here!
- // VDTOR-THUNKS-Test5: VFTable for 'vdtor::Test4' in 'vdtor::Test5' (1 entries).
- // VDTOR-THUNKS-Test5-NEXT: 0 | void vdtor::Test4::z4()
+ // CHECK-LABEL: VFTable for 'vdtor::Test4' in 'vdtor::Test5' (1 entry).
+ // CHECK-NEXT: 0 | void vdtor::Test4::z4()
- // VDTOR-THUNKS-Test5: VFTable for 'vdtor::Test2' in 'vdtor::Test5' (1 entries).
- // VDTOR-THUNKS-Test5-NEXT: 0 | vdtor::Test5::~Test5() [scalar deleting]
- // VDTOR-THUNKS-Test5-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'vdtor::Test2' in 'vdtor::Test5' (1 entry).
+ // CHECK-NEXT: 0 | vdtor::Test5::~Test5() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test5: Thunks for 'vdtor::Test5::~Test5()' (1 entry).
- // VDTOR-THUNKS-Test5-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtor::Test5::~Test5()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test5: VFTable indices for 'vdtor::Test5' (1 entries).
- // VDTOR-THUNKS-Test5-NEXT: -- accessible via vfptr at offset 4 --
- // VDTOR-THUNKS-Test5-NEXT: 0 | vdtor::Test5::~Test5() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtor::Test5' (1 entry).
+ // CHECK-NEXT: -- accessible via vfptr at offset 4 --
+ // CHECK-NEXT: 0 | vdtor::Test5::~Test5() [scalar deleting]
};
Test5 t5;
+void use(Test5 *obj) { delete obj; }
struct Test6 : Test4, Test2 {
// Implicit virtual dtor here!
- // VDTOR-THUNKS-Test6: VFTable for 'vdtor::Test4' in 'vdtor::Test6' (1 entries).
- // VDTOR-THUNKS-Test6-NEXT: 0 | void vdtor::Test4::z4()
+ // CHECK-LABEL: VFTable for 'vdtor::Test4' in 'vdtor::Test6' (1 entry).
+ // CHECK-NEXT: 0 | void vdtor::Test4::z4()
- // VDTOR-THUNKS-Test6: VFTable for 'vdtor::Test2' in 'vdtor::Test6' (1 entries).
- // VDTOR-THUNKS-Test6-NEXT: 0 | vdtor::Test6::~Test6() [scalar deleting]
- // VDTOR-THUNKS-Test6-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'vdtor::Test2' in 'vdtor::Test6' (1 entry).
+ // CHECK-NEXT: 0 | vdtor::Test6::~Test6() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test6: Thunks for 'vdtor::Test6::~Test6()' (1 entry).
- // VDTOR-THUNKS-Test6-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtor::Test6::~Test6()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test6: VFTable indices for 'vdtor::Test6' (1 entries).
- // VDTOR-THUNKS-Test6-NEXT: -- accessible via vfptr at offset 4 --
- // VDTOR-THUNKS-Test6-NEXT: 0 | vdtor::Test6::~Test6() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtor::Test6' (1 entry).
+ // CHECK-NEXT: -- accessible via vfptr at offset 4 --
+ // CHECK-NEXT: 0 | vdtor::Test6::~Test6() [scalar deleting]
};
Test6 t6;
+void use(Test6 *obj) { delete obj; }
struct Test7 : Test5 {
- // VDTOR-THUNKS-Test7: VFTable for 'vdtor::Test4' in 'vdtor::Test5' in 'vdtor::Test7' (1 entries).
- // VDTOR-THUNKS-Test7-NEXT: 0 | void vdtor::Test4::z4()
+ // CHECK-LABEL: VFTable for 'vdtor::Test4' in 'vdtor::Test5' in 'vdtor::Test7' (1 entry).
+ // CHECK-NEXT: 0 | void vdtor::Test4::z4()
- // VDTOR-THUNKS-Test7: VFTable for 'vdtor::Test2' in 'vdtor::Test5' in 'vdtor::Test7' (1 entries).
- // VDTOR-THUNKS-Test7-NEXT: 0 | vdtor::Test7::~Test7() [scalar deleting]
- // VDTOR-THUNKS-Test7-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: VFTable for 'vdtor::Test2' in 'vdtor::Test5' in 'vdtor::Test7' (1 entry).
+ // CHECK-NEXT: 0 | vdtor::Test7::~Test7() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test7: Thunks for 'vdtor::Test7::~Test7()' (1 entry).
- // VDTOR-THUNKS-Test7-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtor::Test7::~Test7()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTOR-THUNKS-Test7: VFTable indices for 'vdtor::Test7' (1 entries).
- // VDTOR-THUNKS-Test7-NEXT: -- accessible via vfptr at offset 4 --
- // VDTOR-THUNKS-Test7-NEXT: 0 | vdtor::Test7::~Test7() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtor::Test7' (1 entry).
+ // CHECK-NEXT: -- accessible via vfptr at offset 4 --
+ // CHECK-NEXT: 0 | vdtor::Test7::~Test7() [scalar deleting]
virtual ~Test7();
};
Test7 t7;
+void use(Test7 *obj) { delete obj; }
}
@@ -456,14 +449,17 @@
};
struct Test1 : Ret1 {
- // RET-THUNKS-Test1: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' (3 entries).
- // RET-THUNKS-Test1-NEXT: 0 | this_adjustment::Test1 *return_adjustment::Test1::foo()
- // RET-THUNKS-Test1-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test1-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test1-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test1::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' (3 entries).
+ // CHECK-NEXT: 0 | this_adjustment::Test1 *return_adjustment::Test1::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 4 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test1::foo()
- // RET-THUNKS-Test1: VFTable indices for 'return_adjustment::Test1' (1 entries).
- // RET-THUNKS-Test1-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test1::foo()
+ // CHECK-LABEL: Thunks for 'this_adjustment::Test1 *return_adjustment::Test1::foo()' (1 entry).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct C *'): 4 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test1' (1 entry).
+ // CHECK-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test1::foo()
// MANGLING-DAG: @"\01??_7Test1@return_adjustment@@6B@"
@@ -471,109 +467,143 @@
};
Test1 t1;
+void use(Test1 *obj) { obj->foo(); }
struct Ret2 : B, this_adjustment::Test1 { };
struct Test2 : Test1 {
- // RET-THUNKS-Test2: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test2' (4 entries).
- // RET-THUNKS-Test2-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
- // RET-THUNKS-Test2-NEXT: [return adjustment: 8 non-virtual]
- // RET-THUNKS-Test2-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test2-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
- // RET-THUNKS-Test2-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test2-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test2' (4 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 8 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
- // RET-THUNKS-Test2: VFTable indices for 'return_adjustment::Test2' (1 entries).
- // RET-THUNKS-Test2-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::Ret2 *return_adjustment::Test2::foo()' (2 entries).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: 1 | [return adjustment (to type 'struct C *'): 8 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test2' (1 entry).
+ // CHECK-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test2::foo()
virtual Ret2* foo();
};
Test2 t2;
+void use(Test2 *obj) { obj->foo(); }
struct Test3: B, Ret1 {
- // RET-THUNKS-Test3: VFTable for 'B' in 'return_adjustment::Test3' (2 entries).
- // RET-THUNKS-Test3-NEXT: 0 | void B::g()
- // RET-THUNKS-Test3-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'return_adjustment::Test3' (2 entries).
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // RET-THUNKS-Test3: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test3' (3 entries).
- // RET-THUNKS-Test3-NEXT: 0 | this_adjustment::Test1 *return_adjustment::Test3::foo()
- // RET-THUNKS-Test3-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test3-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test3-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test3::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test3' (3 entries).
+ // CHECK-NEXT: 0 | this_adjustment::Test1 *return_adjustment::Test3::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 4 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test3::foo()
- // RET-THUNKS-Test3: VFTable indices for 'return_adjustment::Test3' (1 entries).
- // RET-THUNKS-Test3-NEXT: via vfptr at offset 4
- // RET-THUNKS-Test3-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test3::foo()
+ // CHECK-LABEL: Thunks for 'this_adjustment::Test1 *return_adjustment::Test3::foo()' (1 entry).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct C *'): 4 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test3' (1 entry).
+ // CHECK-NEXT: via vfptr at offset 4
+ // CHECK-NEXT: 2 | this_adjustment::Test1 *return_adjustment::Test3::foo()
virtual this_adjustment::Test1* foo();
};
Test3 t3;
+void use(Test3 *obj) { obj->foo(); }
struct Test4 : Test3 {
- // RET-THUNKS-Test4: VFTable for 'B' in 'return_adjustment::Test3' in 'return_adjustment::Test4' (2 entries).
- // RET-THUNKS-Test4-NEXT: 0 | void B::g()
- // RET-THUNKS-Test4-NEXT: 1 | void B::h()
+ // CHECK-LABEL: VFTable for 'B' in 'return_adjustment::Test3' in 'return_adjustment::Test4' (2 entries).
+ // CHECK-NEXT: 0 | void B::g()
+ // CHECK-NEXT: 1 | void B::h()
- // RET-THUNKS-Test4: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test3' in 'return_adjustment::Test4' (4 entries).
- // RET-THUNKS-Test4-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
- // RET-THUNKS-Test4-NEXT: [return adjustment: 8 non-virtual]
- // RET-THUNKS-Test4-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test4-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
- // RET-THUNKS-Test4-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test4-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test3' in 'return_adjustment::Test4' (4 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 8 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
- // RET-THUNKS-Test4: VFTable indices for 'return_adjustment::Test4' (1 entries).
- // RET-THUNKS-Test4-NEXT: -- accessible via vfptr at offset 4 --
- // RET-THUNKS-Test4-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::Ret2 *return_adjustment::Test4::foo()' (2 entries).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: 1 | [return adjustment (to type 'struct C *'): 8 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test4' (1 entry).
+ // CHECK-NEXT: -- accessible via vfptr at offset 4 --
+ // CHECK-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test4::foo()
virtual Ret2* foo();
};
Test4 t4;
+void use(Test4 *obj) { obj->foo(); }
struct Test5 : Ret1, Test1 {
- // RET-THUNKS-Test5: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test5' (3 entries).
- // RET-THUNKS-Test5-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
- // RET-THUNKS-Test5-NEXT: [return adjustment: 8 non-virtual]
- // RET-THUNKS-Test5-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test5-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test5' (3 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 8 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
- // RET-THUNKS-Test5: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test5' (4 entries).
- // RET-THUNKS-Test5-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
- // RET-THUNKS-Test5-NEXT: [return adjustment: 8 non-virtual]
- // RET-THUNKS-Test5-NEXT: [this adjustment: -4 non-virtual]
- // RET-THUNKS-Test5-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test5-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
- // RET-THUNKS-Test5-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test5-NEXT: [this adjustment: -4 non-virtual]
- // RET-THUNKS-Test5-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
- // RET-THUNKS-Test5-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'return_adjustment::Ret2 *return_adjustment::Test5::foo()' (1 entry).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct C *'): 8 non-virtual]
- // RET-THUNKS-Test5: VFTable indices for 'return_adjustment::Test5' (1 entries).
- // RET-THUNKS-Test5-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test5' (4 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 8 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 3 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct return_adjustment::Ret2 *'): 0 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'return_adjustment::Ret2 *return_adjustment::Test5::foo()' (3 entries).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct return_adjustment::Ret2 *'): 0 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 1 | [return adjustment (to type 'struct this_adjustment::Test1 *'): 4 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 2 | [return adjustment (to type 'struct C *'): 8 non-virtual]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test5' (1 entry).
+ // CHECK-NEXT: 2 | return_adjustment::Ret2 *return_adjustment::Test5::foo()
virtual Ret2* foo();
};
Test5 t5;
+void use(Test5 *obj) { obj->foo(); }
struct Ret3 : this_adjustment::Test1 { };
struct Test6 : Test1 {
virtual Ret3* foo();
- // RET-THUNKS-Test6: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test6' (4 entries).
- // RET-THUNKS-Test6-NEXT: 0 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
- // RET-THUNKS-Test6-NEXT: [return adjustment: 4 non-virtual]
- // RET-THUNKS-Test6-NEXT: 1 | void return_adjustment::Ret1::z()
- // RET-THUNKS-Test6-NEXT: 2 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
- // RET-THUNKS-Test6-NEXT: 3 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Ret1' in 'return_adjustment::Test1' in 'return_adjustment::Test6' (4 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct C *'): 4 non-virtual]
+ // CHECK-NEXT: 1 | void return_adjustment::Ret1::z()
+ // CHECK-NEXT: 2 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct this_adjustment::Test1 *'): 0 non-virtual]
+ // CHECK-NEXT: 3 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
- // RET-THUNKS-Test6: VFTable indices for 'return_adjustment::Test6' (1 entries).
- // RET-THUNKS-Test6-NEXT: 3 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::Ret3 *return_adjustment::Test6::foo()' (2 entries).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct this_adjustment::Test1 *'): 0 non-virtual]
+ // CHECK-NEXT: 1 | [return adjustment (to type 'struct C *'): 4 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::Test6' (1 entry).
+ // CHECK-NEXT: 3 | return_adjustment::Ret3 *return_adjustment::Test6::foo()
};
Test6 t6;
+void use(Test6 *obj) { obj->foo(); }
}
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp b/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp
new file mode 100644
index 0000000..a4a2110
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -fno-rtti %s -emit-llvm -o %t -triple=i386-pc-win32 -fdump-vtable-layouts 2>&1 | FileCheck --check-prefix=VFTABLES %s
+// RUN: FileCheck --check-prefix=GLOBALS %s < %t
+// RUN: FileCheck --check-prefix=CODEGEN %s < %t
+
+namespace test1 {
+
+// Some covariant types.
+struct A { int a; };
+struct B { int b; };
+struct C : A, B { int c; };
+struct D : C { int d; };
+struct E : D { int e; };
+
+// One base class and two overrides, all with covariant return types.
+struct H { virtual B *foo(); };
+struct I : H { virtual C *foo(); };
+struct J : I { virtual D *foo(); J(); };
+struct K : J { virtual E *foo(); K(); };
+
+J::J() {}
+
+// VFTABLES-LABEL: VFTable for 'test1::H' in 'test1::I' in 'test1::J' (3 entries).
+// VFTABLES-NEXT: 0 | test1::D *test1::J::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test1::B *'): 4 non-virtual]
+// VFTABLES-NEXT: 1 | test1::D *test1::J::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test1::C *'): 0 non-virtual]
+// VFTABLES-NEXT: 2 | test1::D *test1::J::foo()
+
+// GLOBALS-LABEL: @"\01??_7J@test1@@6B@" = linkonce_odr unnamed_addr constant [3 x i8*]
+// GLOBALS: @"\01?foo@J@test1@@QAEPAUB@2@XZ"
+// GLOBALS: @"\01?foo@J@test1@@QAEPAUC@2@XZ"
+// GLOBALS: @"\01?foo@J@test1@@UAEPAUD@2@XZ"
+
+K::K() {}
+
+// VFTABLES-LABEL: VFTable for 'test1::H' in 'test1::I' in 'test1::J' in 'test1::K' (4 entries).
+// VFTABLES-NEXT: 0 | test1::E *test1::K::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test1::B *'): 4 non-virtual]
+// VFTABLES-NEXT: 1 | test1::E *test1::K::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test1::C *'): 0 non-virtual]
+// VFTABLES-NEXT: 2 | test1::E *test1::K::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test1::D *'): 0 non-virtual]
+// VFTABLES-NEXT: 3 | test1::E *test1::K::foo()
+
+// Only B to C requires adjustment, but we get 3 thunks in K's vftable, two of
+// which are trivial.
+// GLOBALS-LABEL: @"\01??_7K@test1@@6B@" = linkonce_odr unnamed_addr constant [4 x i8*]
+// GLOBALS: @"\01?foo@K@test1@@QAEPAUB@2@XZ"
+// GLOBALS: @"\01?foo@K@test1@@QAEPAUC@2@XZ"
+// GLOBALS: @"\01?foo@K@test1@@QAEPAUD@2@XZ"
+// GLOBALS: @"\01?foo@K@test1@@UAEPAUE@2@XZ"
+
+// This thunk has a return adjustment.
+// CODEGEN-LABEL: define {{.*}} @"\01?foo@K@test1@@QAEPAUB@2@XZ"
+// CODEGEN: call {{.*}} @"\01?foo@K@test1@@UAEPAUE@2@XZ"
+// CODEGEN: icmp {{.*}}, null
+// CODEGEN: getelementptr
+// CODEGEN: ret
+
+// These two don't.
+// CODEGEN-LABEL: define {{.*}} @"\01?foo@K@test1@@QAEPAUC@2@XZ"
+// CODEGEN: call {{.*}} @"\01?foo@K@test1@@UAEPAUE@2@XZ"
+// CODEGEN-NEXT: ret
+
+// CODEGEN-LABEL: define {{.*}} @"\01?foo@K@test1@@QAEPAUD@2@XZ"
+// CODEGEN: call {{.*}} @"\01?foo@K@test1@@UAEPAUE@2@XZ"
+// CODEGEN-NEXT: ret
+
+}
+
+namespace test2 {
+
+// Covariant types. D* is not trivially convertible to C*.
+struct A { int a; };
+struct B { int b; };
+struct C : B { int c; };
+struct D : A, C { int d; };
+struct E : D { int e; };
+
+// J's foo will require an adjusting thunk, and K will require a trivial thunk.
+struct H { virtual B *foo(); };
+struct I : H { virtual C *foo(); };
+struct J : I { virtual D *foo(); J(); };
+struct K : J { virtual E *foo(); K(); };
+
+J::J() {}
+
+// VFTABLES-LABEL: VFTable for 'test2::H' in 'test2::I' in 'test2::J' (2 entries).
+// VFTABLES-NEXT: 0 | test2::D *test2::J::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test2::B *'): 4 non-virtual]
+// VFTABLES-NEXT: 1 | test2::D *test2::J::foo()
+
+// GLOBALS-LABEL: @"\01??_7J@test2@@6B@" = linkonce_odr unnamed_addr constant [2 x i8*]
+
+K::K() {}
+
+// VFTABLES-LABEL: VFTable for 'test2::H' in 'test2::I' in 'test2::J' in 'test2::K' (3 entries).
+// VFTABLES-NEXT: 0 | test2::E *test2::K::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test2::B *'): 4 non-virtual]
+// VFTABLES-NEXT: 1 | test2::E *test2::K::foo()
+// VFTABLES-NEXT: [return adjustment (to type 'struct test2::D *'): 0 non-virtual]
+// VFTABLES-NEXT: 2 | test2::E *test2::K::foo()
+
+// GLOBALS-LABEL: @"\01??_7K@test2@@6B@" = linkonce_odr unnamed_addr constant [3 x i8*]
+
+}
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
index 6fe12b0..d453f5c 100644
--- a/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
@@ -1,29 +1,17 @@
-// RUN: %clang_cc1 %s -fno-rtti -cxx-abi microsoft -triple=i386-pc-win32 -emit-llvm -fdump-vtable-layouts -o %t.ll > %t
+// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -fdump-vtable-layouts -o %t.ll > %t
// RUN: FileCheck --check-prefix=EMITS-VFTABLE %s < %t.ll
// RUN: FileCheck --check-prefix=NO-VFTABLE %s < %t.ll
-// RUN: FileCheck --check-prefix=CHECK-A %s < %t
-// RUN: FileCheck --check-prefix=CHECK-B %s < %t
-// RUN: FileCheck --check-prefix=CHECK-C %s < %t
-// RUN: FileCheck --check-prefix=CHECK-D %s < %t
-// RUN: FileCheck --check-prefix=CHECK-E %s < %t
-// RUN: FileCheck --check-prefix=CHECK-F %s < %t
-// RUN: FileCheck --check-prefix=CHECK-G %s < %t
-// RUN: FileCheck --check-prefix=CHECK-I %s < %t
-// RUN: FileCheck --check-prefix=CHECK-J %s < %t
-// RUN: FileCheck --check-prefix=CHECK-K %s < %t
-// RUN: FileCheck --check-prefix=CHECK-L %s < %t
-// RUN: FileCheck --check-prefix=CHECK-M %s < %t
-// RUN: FileCheck --check-prefix=CHECK-N %s < %t
+// RUN: FileCheck %s < %t
struct A {
- // CHECK-A: VFTable for 'A' (3 entries)
- // CHECK-A-NEXT: 0 | void A::f()
- // CHECK-A-NEXT: 1 | void A::g()
- // CHECK-A-NEXT: 2 | void A::h()
- // CHECK-A: VFTable indices for 'A' (3 entries)
- // CHECK-A-NEXT: 0 | void A::f()
- // CHECK-A-NEXT: 1 | void A::g()
- // CHECK-A-NEXT: 2 | void A::h()
+ // CHECK-LABEL: VFTable for 'A' (3 entries)
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
+ // CHECK-LABEL: VFTable indices for 'A' (3 entries)
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
virtual void f();
virtual void g();
@@ -32,18 +20,19 @@
};
A a;
// EMITS-VFTABLE-DAG: @"\01??_7A@@6B@" = linkonce_odr unnamed_addr constant [3 x i8*]
+void use(A *obj) { obj->f(); }
struct B : A {
- // CHECK-B: VFTable for 'A' in 'B' (5 entries)
- // CHECK-B-NEXT: 0 | void B::f()
- // CHECK-B-NEXT: 1 | void A::g()
- // CHECK-B-NEXT: 2 | void A::h()
- // CHECK-B-NEXT: 3 | void B::i()
- // CHECK-B-NEXT: 4 | void B::j()
- // CHECK-B: VFTable indices for 'B' (3 entries)
- // CHECK-B-NEXT: 0 | void B::f()
- // CHECK-B-NEXT: 3 | void B::i()
- // CHECK-B-NEXT: 4 | void B::j()
+ // CHECK-LABEL: VFTable for 'A' in 'B' (5 entries)
+ // CHECK-NEXT: 0 | void B::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
+ // CHECK-NEXT: 3 | void B::i()
+ // CHECK-NEXT: 4 | void B::j()
+ // CHECK-LABEL: VFTable indices for 'B' (3 entries)
+ // CHECK-NEXT: 0 | void B::f()
+ // CHECK-NEXT: 3 | void B::i()
+ // CHECK-NEXT: 4 | void B::j()
virtual void f(); // overrides A::f()
virtual void i();
@@ -51,45 +40,48 @@
};
B b;
// EMITS-VFTABLE-DAG: @"\01??_7B@@6B@" = linkonce_odr unnamed_addr constant [5 x i8*]
+void use(B *obj) { obj->f(); }
struct C {
- // CHECK-C: VFTable for 'C' (2 entries)
- // CHECK-C-NEXT: 0 | C::~C() [scalar deleting]
- // CHECK-C-NEXT: 1 | void C::f()
- // CHECK-C: VFTable indices for 'C' (2 entries).
- // CHECK-C-NEXT: 0 | C::~C() [scalar deleting]
- // CHECK-C-NEXT: 1 | void C::f()
+ // CHECK-LABEL: VFTable for 'C' (2 entries)
+ // CHECK-NEXT: 0 | C::~C() [scalar deleting]
+ // CHECK-NEXT: 1 | void C::f()
+ // CHECK-LABEL: VFTable indices for 'C' (2 entries).
+ // CHECK-NEXT: 0 | C::~C() [scalar deleting]
+ // CHECK-NEXT: 1 | void C::f()
virtual ~C();
virtual void f();
};
void C::f() {}
// NO-VFTABLE-NOT: @"\01??_7C@@6B@"
+void use(C *obj) { obj->f(); }
struct D {
- // CHECK-D: VFTable for 'D' (2 entries)
- // CHECK-D-NEXT: 0 | void D::f()
- // CHECK-D-NEXT: 1 | D::~D() [scalar deleting]
- // CHECK-D: VFTable indices for 'D' (2 entries)
- // CHECK-D-NEXT: 0 | void D::f()
- // CHECK-D-NEXT: 1 | D::~D() [scalar deleting]
+ // CHECK-LABEL: VFTable for 'D' (2 entries)
+ // CHECK-NEXT: 0 | void D::f()
+ // CHECK-NEXT: 1 | D::~D() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'D' (2 entries)
+ // CHECK-NEXT: 0 | void D::f()
+ // CHECK-NEXT: 1 | D::~D() [scalar deleting]
virtual void f();
virtual ~D();
};
D d;
// EMITS-VFTABLE-DAG: @"\01??_7D@@6B@" = linkonce_odr unnamed_addr constant [2 x i8*]
+void use(D *obj) { obj->f(); }
struct E : A {
- // CHECK-E: VFTable for 'A' in 'E' (5 entries)
- // CHECK-E-NEXT: 0 | void A::f()
- // CHECK-E-NEXT: 1 | void A::g()
- // CHECK-E-NEXT: 2 | void A::h()
- // CHECK-E-NEXT: 3 | E::~E() [scalar deleting]
- // CHECK-E-NEXT: 4 | void E::i()
- // CHECK-E: VFTable indices for 'E' (2 entries).
- // CHECK-E-NEXT: 3 | E::~E() [scalar deleting]
- // CHECK-E-NEXT: 4 | void E::i()
+ // CHECK-LABEL: VFTable for 'A' in 'E' (5 entries)
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
+ // CHECK-NEXT: 3 | E::~E() [scalar deleting]
+ // CHECK-NEXT: 4 | void E::i()
+ // CHECK-LABEL: VFTable indices for 'E' (2 entries).
+ // CHECK-NEXT: 3 | E::~E() [scalar deleting]
+ // CHECK-NEXT: 4 | void E::i()
// ~E would be the key method, but it isn't used, and MS ABI has no key
// methods.
@@ -98,36 +90,38 @@
};
void E::i() {}
// NO-VFTABLE-NOT: @"\01??_7E@@6B@"
+void use(E *obj) { obj->i(); }
struct F : A {
- // CHECK-F: VFTable for 'A' in 'F' (5 entries)
- // CHECK-F-NEXT: 0 | void A::f()
- // CHECK-F-NEXT: 1 | void A::g()
- // CHECK-F-NEXT: 2 | void A::h()
- // CHECK-F-NEXT: 3 | void F::i()
- // CHECK-F-NEXT: 4 | F::~F() [scalar deleting]
- // CHECK-F: VFTable indices for 'F' (2 entries).
- // CHECK-F-NEXT: 3 | void F::i()
- // CHECK-F-NEXT: 4 | F::~F() [scalar deleting]
+ // CHECK-LABEL: VFTable for 'A' in 'F' (5 entries)
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
+ // CHECK-NEXT: 3 | void F::i()
+ // CHECK-NEXT: 4 | F::~F() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'F' (2 entries).
+ // CHECK-NEXT: 3 | void F::i()
+ // CHECK-NEXT: 4 | F::~F() [scalar deleting]
virtual void i();
virtual ~F();
};
F f;
// EMITS-VFTABLE-DAG: @"\01??_7F@@6B@" = linkonce_odr unnamed_addr constant [5 x i8*]
+void use(F *obj) { obj->i(); }
struct G : E {
- // CHECK-G: VFTable for 'A' in 'E' in 'G' (6 entries)
- // CHECK-G-NEXT: 0 | void G::f()
- // CHECK-G-NEXT: 1 | void A::g()
- // CHECK-G-NEXT: 2 | void A::h()
- // CHECK-G-NEXT: 3 | G::~G() [scalar deleting]
- // CHECK-G-NEXT: 4 | void E::i()
- // CHECK-G-NEXT: 5 | void G::j()
- // CHECK-G: VFTable indices for 'G' (3 entries).
- // CHECK-G-NEXT: 0 | void G::f()
- // CHECK-G-NEXT: 3 | G::~G() [scalar deleting]
- // CHECK-G-NEXT: 5 | void G::j()
+ // CHECK-LABEL: VFTable for 'A' in 'E' in 'G' (6 entries)
+ // CHECK-NEXT: 0 | void G::f()
+ // CHECK-NEXT: 1 | void A::g()
+ // CHECK-NEXT: 2 | void A::h()
+ // CHECK-NEXT: 3 | G::~G() [scalar deleting]
+ // CHECK-NEXT: 4 | void E::i()
+ // CHECK-NEXT: 5 | void G::j()
+ // CHECK-LABEL: VFTable indices for 'G' (3 entries).
+ // CHECK-NEXT: 0 | void G::f()
+ // CHECK-NEXT: 3 | G::~G() [scalar deleting]
+ // CHECK-NEXT: 5 | void G::j()
virtual void f(); // overrides A::f()
virtual ~G();
@@ -135,6 +129,7 @@
};
void G::j() {}
// NO-VFTABLE-NOT: @"\01??_7G@@6B@"
+void use(G *obj) { obj->j(); }
// Test that the usual Itanium-style key method does not emit a vtable.
struct H {
@@ -146,23 +141,24 @@
struct Empty { };
struct I : Empty {
- // CHECK-I: VFTable for 'I' (2 entries)
- // CHECK-I-NEXT: 0 | void I::f()
- // CHECK-I-NEXT: 1 | void I::g()
+ // CHECK-LABEL: VFTable for 'I' (2 entries)
+ // CHECK-NEXT: 0 | void I::f()
+ // CHECK-NEXT: 1 | void I::g()
virtual void f();
virtual void g();
};
I i;
+void use(I *obj) { obj->f(); }
struct J {
- // CHECK-J: VFTable for 'J' (6 entries)
- // CHECK-J-NEXT: 0 | void J::foo(long)
- // CHECK-J-NEXT: 1 | void J::foo(int)
- // CHECK-J-NEXT: 2 | void J::foo(short)
- // CHECK-J-NEXT: 3 | void J::bar(long)
- // CHECK-J-NEXT: 4 | void J::bar(int)
- // CHECK-J-NEXT: 5 | void J::bar(short)
+ // CHECK-LABEL: VFTable for 'J' (6 entries)
+ // CHECK-NEXT: 0 | void J::foo(long)
+ // CHECK-NEXT: 1 | void J::foo(int)
+ // CHECK-NEXT: 2 | void J::foo(short)
+ // CHECK-NEXT: 3 | void J::bar(long)
+ // CHECK-NEXT: 4 | void J::bar(int)
+ // CHECK-NEXT: 5 | void J::bar(short)
virtual void foo(short);
virtual void bar(short);
virtual void foo(int);
@@ -172,36 +168,38 @@
};
J j;
+void use(J *obj) { obj->foo(42); }
struct K : J {
- // CHECK-K: VFTable for 'J' in 'K' (9 entries)
- // CHECK-K-NEXT: 0 | void J::foo(long)
- // CHECK-K-NEXT: 1 | void J::foo(int)
- // CHECK-K-NEXT: 2 | void J::foo(short)
- // CHECK-K-NEXT: 3 | void J::bar(long)
- // CHECK-K-NEXT: 4 | void J::bar(int)
- // CHECK-K-NEXT: 5 | void J::bar(short)
- // CHECK-K-NEXT: 6 | void K::bar(double)
- // CHECK-K-NEXT: 7 | void K::bar(float)
- // CHECK-K-NEXT: 8 | void K::foo(float)
+ // CHECK-LABEL: VFTable for 'J' in 'K' (9 entries)
+ // CHECK-NEXT: 0 | void J::foo(long)
+ // CHECK-NEXT: 1 | void J::foo(int)
+ // CHECK-NEXT: 2 | void J::foo(short)
+ // CHECK-NEXT: 3 | void J::bar(long)
+ // CHECK-NEXT: 4 | void J::bar(int)
+ // CHECK-NEXT: 5 | void J::bar(short)
+ // CHECK-NEXT: 6 | void K::bar(double)
+ // CHECK-NEXT: 7 | void K::bar(float)
+ // CHECK-NEXT: 8 | void K::foo(float)
virtual void bar(float);
virtual void foo(float);
virtual void bar(double);
};
K k;
+void use(K *obj) { obj->foo(42.0f); }
struct L : J {
- // CHECK-L: VFTable for 'J' in 'L' (9 entries)
- // CHECK-L-NEXT: 0 | void J::foo(long)
- // CHECK-L-NEXT: 1 | void L::foo(int)
- // CHECK-L-NEXT: 2 | void J::foo(short)
- // CHECK-L-NEXT: 3 | void J::bar(long)
- // CHECK-L-NEXT: 4 | void J::bar(int)
- // CHECK-L-NEXT: 5 | void J::bar(short)
- // CHECK-L-NEXT: 6 | void L::foo(float)
- // CHECK-L-NEXT: 7 | void L::bar(double)
- // CHECK-L-NEXT: 8 | void L::bar(float)
+ // CHECK-LABEL: VFTable for 'J' in 'L' (9 entries)
+ // CHECK-NEXT: 0 | void J::foo(long)
+ // CHECK-NEXT: 1 | void L::foo(int)
+ // CHECK-NEXT: 2 | void J::foo(short)
+ // CHECK-NEXT: 3 | void J::bar(long)
+ // CHECK-NEXT: 4 | void J::bar(int)
+ // CHECK-NEXT: 5 | void J::bar(short)
+ // CHECK-NEXT: 6 | void L::foo(float)
+ // CHECK-NEXT: 7 | void L::bar(double)
+ // CHECK-NEXT: 8 | void L::bar(float)
// This case is interesting. Since the J::foo(int) override is the first method in
// the class, foo(float) precedes the bar(double) and bar(float) in the vftable.
@@ -212,20 +210,21 @@
};
L l;
+void use(L *obj) { obj->foo(42.0f); }
struct M : J {
- // CHECK-M: VFTable for 'J' in 'M' (11 entries)
- // CHECK-M-NEXT: 0 | void J::foo(long)
- // CHECK-M-NEXT: 1 | void M::foo(int)
- // CHECK-M-NEXT: 2 | void J::foo(short)
- // CHECK-M-NEXT: 3 | void J::bar(long)
- // CHECK-M-NEXT: 4 | void J::bar(int)
- // CHECK-M-NEXT: 5 | void J::bar(short)
- // CHECK-M-NEXT: 6 | void M::foo(float)
- // CHECK-M-NEXT: 7 | void M::spam(long)
- // CHECK-M-NEXT: 8 | void M::spam(int)
- // CHECK-M-NEXT: 9 | void M::bar(double)
- // CHECK-M-NEXT: 10 | void M::bar(float)
+ // CHECK-LABEL: VFTable for 'J' in 'M' (11 entries)
+ // CHECK-NEXT: 0 | void J::foo(long)
+ // CHECK-NEXT: 1 | void M::foo(int)
+ // CHECK-NEXT: 2 | void J::foo(short)
+ // CHECK-NEXT: 3 | void J::bar(long)
+ // CHECK-NEXT: 4 | void J::bar(int)
+ // CHECK-NEXT: 5 | void J::bar(short)
+ // CHECK-NEXT: 6 | void M::foo(float)
+ // CHECK-NEXT: 7 | void M::spam(long)
+ // CHECK-NEXT: 8 | void M::spam(int)
+ // CHECK-NEXT: 9 | void M::bar(double)
+ // CHECK-NEXT: 10 | void M::bar(float)
virtual void foo(int);
virtual void spam(int);
@@ -236,13 +235,14 @@
};
M m;
+void use(M *obj) { obj->foo(42.0f); }
struct N {
- // CHECK-N: VFTable for 'N' (4 entries)
- // CHECK-N-NEXT: 0 | void N::operator+(int)
- // CHECK-N-NEXT: 1 | void N::operator+(short)
- // CHECK-N-NEXT: 2 | void N::operator*(int)
- // CHECK-N-NEXT: 3 | void N::operator*(short)
+ // CHECK-LABEL: VFTable for 'N' (4 entries)
+ // CHECK-NEXT: 0 | void N::operator+(int)
+ // CHECK-NEXT: 1 | void N::operator+(short)
+ // CHECK-NEXT: 2 | void N::operator*(int)
+ // CHECK-NEXT: 3 | void N::operator*(short)
virtual void operator+(short);
virtual void operator*(short);
virtual void operator+(int);
@@ -250,3 +250,42 @@
};
N n;
+void use(N *obj) { obj->operator+(42); }
+
+struct O { virtual A *f(); };
+struct P : O { virtual B *f(); };
+P p;
+void use(O *obj) { obj->f(); }
+void use(P *obj) { obj->f(); }
+// CHECK-LABEL: VFTable for 'O' (1 entry)
+// CHECK-NEXT: 0 | A *O::f()
+
+// CHECK-LABEL: VFTable for 'O' in 'P' (1 entry)
+// CHECK-NEXT: 0 | B *P::f()
+
+struct Q {
+ // CHECK-LABEL: VFTable for 'Q' (2 entries)
+ // CHECK-NEXT: 0 | void Q::foo(int)
+ // CHECK-NEXT: 1 | void Q::bar(int)
+ void foo(short);
+ void bar(short);
+ virtual void bar(int);
+ virtual void foo(int);
+};
+
+Q q;
+void use(Q *obj) { obj->foo(42); }
+
+// Inherited non-virtual overloads don't participate in the ordering.
+struct R : Q {
+ // CHECK-LABEL: VFTable for 'Q' in 'R' (4 entries)
+ // CHECK-NEXT: 0 | void Q::foo(int)
+ // CHECK-NEXT: 1 | void Q::bar(int)
+ // CHECK-NEXT: 2 | void R::bar(long)
+ // CHECK-NEXT: 3 | void R::foo(long)
+ virtual void bar(long);
+ virtual void foo(long);
+};
+
+R r;
+void use(R *obj) { obj->foo(42l); }
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance-vtordisps.cpp b/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance-vtordisps.cpp
index 3fef0e4..6dac30e 100644
--- a/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance-vtordisps.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance-vtordisps.cpp
@@ -1,19 +1,9 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -fdump-vtable-layouts %s -o %t.ll -cxx-abi microsoft -triple=i386-pc-win32 >%t
-// RUN: FileCheck --check-prefix=VTABLE-SIMPLE-A %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-SIMPLE-B %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-SIMPLE-C %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-A %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-B %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-C %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-E %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-F %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-G %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-EXTENDED-H %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-PR17738-A %s < %t
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -fdump-vtable-layouts %s -o %t.ll -triple=i386-pc-win32 > %t
+// RUN: FileCheck %s < %t
// RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
// For now, just make sure x86_64 doesn't crash.
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -fdump-vtable-layouts %s -cxx-abi microsoft -triple=x86_64-pc-win32 >/dev/null
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -fdump-vtable-layouts %s -triple=x86_64-pc-win32 > /dev/null
struct V1 {
virtual void f();
@@ -64,11 +54,17 @@
// jmp Method@Class
struct A : virtual V1 {
- // VTABLE-SIMPLE-A: VFTable for 'V1' in 'simple::A' (2 entries).
- // VTABLE-SIMPLE-A-NEXT: 0 | void simple::A::f()
- // VTABLE-SIMPLE-A-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
- // VTABLE-SIMPLE-A-NEXT: 1 | simple::A::~A() [scalar deleting]
- // VTABLE-SIMPLE-A-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' (2 entries).
+ // CHECK-NEXT: 0 | void simple::A::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-NEXT: 1 | simple::A::~A() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'simple::A::~A()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, 0 non-virtual]
virtual void f();
// MANGLING-DAG: @"\01?f@A@simple@@$4PPPPPPPM@A@AEXXZ"
@@ -78,18 +74,28 @@
};
A a;
+void use(A *obj) { obj->f(); }
struct B : virtual V3 {
- // VTABLE-SIMPLE-B: VFTable for 'Z' in 'V3' in 'simple::B' (2 entries).
- // VTABLE-SIMPLE-B-NEXT: 0 | void Z::g()
- // VTABLE-SIMPLE-B-NEXT: 1 | simple::B::~B() [scalar deleting]
- // VTABLE-SIMPLE-B-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-LABEL: VFTable for 'Z' in 'V3' in 'simple::B' (2 entries).
+ // CHECK-NEXT: 0 | void Z::g()
+ // CHECK-NEXT: 1 | simple::B::~B() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
- // VTABLE-SIMPLE-B: VFTable for 'V2' in 'V3' in 'simple::B' (2 entries).
- // VTABLE-SIMPLE-B-NEXT: 0 | void simple::B::f()
- // VTABLE-SIMPLE-B-NEXT: [this adjustment: vtordisp at -12, 0 non-virtual]
- // VTABLE-SIMPLE-B-NEXT: 1 | simple::B::~B() [scalar deleting]
- // VTABLE-SIMPLE-B-NEXT: [this adjustment: vtordisp at -12, -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'simple::B::~B()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: VFTable for 'V2' in 'V3' in 'simple::B' (2 entries).
+ // CHECK-NEXT: 0 | void simple::B::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -12, 0 non-virtual]
+ // CHECK-NEXT: 1 | simple::B::~B() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -12, -8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'simple::B::~B()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -12, -8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::B::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -12, 0 non-virtual]
// FIXME: The vtordisp thunk should only get emitted for a constructor
// if "this" leaves scope.
@@ -104,24 +110,40 @@
};
B b;
+void use(B *obj) { obj->f(); }
struct C : virtual V4 {
- // VTABLE-SIMPLE-C: VFTable for 'Z' in 'V4' in 'simple::C' (2 entries).
- // VTABLE-SIMPLE-C-NEXT: 0 | void Z::g()
- // VTABLE-SIMPLE-C-NEXT: 1 | simple::C::~C() [scalar deleting]
- // VTABLE-SIMPLE-C-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-LABEL: VFTable for 'Z' in 'V4' in 'simple::C' (2 entries).
+ // CHECK-NEXT: 0 | void Z::g()
+ // CHECK-NEXT: 1 | simple::C::~C() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
- // VTABLE-SIMPLE-C: VFTable for 'V1' in 'V4' in 'simple::C' (2 entries).
- // VTABLE-SIMPLE-C-NEXT: 0 | void simple::C::f()
- // VTABLE-SIMPLE-C-NEXT: [this adjustment: vtordisp at -12, 0 non-virtual]
- // VTABLE-SIMPLE-C-NEXT: 1 | simple::C::~C() [scalar deleting]
- // VTABLE-SIMPLE-C-NEXT: [this adjustment: vtordisp at -12, -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'simple::C::~C()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, 0 non-virtual]
- // VTABLE-SIMPLE-C: VFTable for 'V2' in 'V4' in 'simple::C' (2 entries).
- // VTABLE-SIMPLE-C-NEXT: 0 | void simple::C::f()
- // VTABLE-SIMPLE-C-NEXT: [this adjustment: vtordisp at -16, -4 non-virtual]
- // VTABLE-SIMPLE-C-NEXT: 1 | simple::C::~C() [scalar deleting]
- // VTABLE-SIMPLE-C-NEXT: [this adjustment: vtordisp at -16, -12 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'V4' in 'simple::C' (2 entries).
+ // CHECK-NEXT: 0 | void simple::C::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -12, 0 non-virtual]
+ // CHECK-NEXT: 1 | simple::C::~C() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -12, -8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'simple::C::~C()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -12, -8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::C::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -12, 0 non-virtual]
+
+ // CHECK-LABEL: VFTable for 'V2' in 'V4' in 'simple::C' (2 entries).
+ // CHECK-NEXT: 0 | void simple::C::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -16, -4 non-virtual]
+ // CHECK-NEXT: 1 | simple::C::~C() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -16, -12 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'simple::C::~C()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -16, -12 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::C::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -16, -4 non-virtual]
int x;
virtual void f();
@@ -134,6 +156,7 @@
};
C c;
+void use(C *obj) { obj->f(); }
}
namespace extended {
@@ -152,12 +175,16 @@
// jmp Method@Class
struct A : virtual simple::A {
- // VTABLE-EXTENDED-A: VFTable for 'V1' in 'simple::A' in 'extended::A' (2 entries).
- // VTABLE-EXTENDED-A-NEXT: 0 | void simple::A::f()
- // VTABLE-EXTENDED-A-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
- // VTABLE-EXTENDED-A-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
- // VTABLE-EXTENDED-A-NEXT: 1 | extended::A::~A() [scalar deleting]
- // VTABLE-EXTENDED-A-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' in 'extended::A' (2 entries).
+ // CHECK-NEXT: 0 | void simple::A::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+ // CHECK-NEXT: 1 | extended::A::~A() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
// `vtordispex{8,8,4294967292,8}'
// MANGLING-DAG: @"\01?f@A@simple@@$R477PPPPPPPM@7AEXXZ"
@@ -168,28 +195,38 @@
};
A a;
+void use(A *obj) { delete obj; }
struct B : virtual simple::A {
// This class has an implicit dtor. Vdtors don't require vtordispex thunks
// as the most derived class always has an implicit dtor,
// which is a final overrider.
- // VTABLE-EXTENDED-B: VFTable for 'V1' in 'simple::A' in 'extended::B' (2 entries).
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' in 'extended::B' (2 entries).
// ...
- // VTABLE-EXTENDED-B: 1 | extended::B::~B() [scalar deleting]
- // VTABLE-EXTENDED-B-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK: 1 | extended::B::~B() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
// vtordisp{4294967292,0}
// MANGLING-DAG: @"\01??_EB@extended@@$4PPPPPPPM@A@AEPAXI@Z"
};
B b;
+void use(B *obj) { delete obj; }
struct C : virtual simple::A {
- // VTABLE-EXTENDED-C: VFTable for 'V1' in 'simple::A' in 'extended::C' (2 entries).
- // VTABLE-EXTENDED-C-NEXT: 0 | void simple::A::f()
- // VTABLE-EXTENDED-C-NEXT: [this adjustment: vtordisp at -4, vbptr at 12 to the left,
- // VTABLE-EXTENDED-C-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' in 'extended::C' (2 entries).
+ // CHECK-NEXT: 0 | void simple::A::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 12 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 12 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
// `vtordispex{12,8,4294967292,8}'
// MANGLING-DAG: @"\01?f@A@simple@@$R4M@7PPPPPPPM@7AEXXZ"
@@ -199,6 +236,7 @@
};
C c;
+void use(C *obj) { delete obj; }
struct D : virtual V2 {
virtual void f();
@@ -207,10 +245,14 @@
};
struct E : virtual D {
- // VTABLE-EXTENDED-E: VFTable for 'V2' in 'extended::D' in 'extended::E' (2 entries).
- // VTABLE-EXTENDED-E-NEXT: 0 | void extended::D::f()
- // VTABLE-EXTENDED-E-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
- // VTABLE-EXTENDED-E-NEXT: vboffset at 8 in the vbtable, 12 non-virtual]
+ // CHECK-LABEL: VFTable for 'V2' in 'extended::D' in 'extended::E' (2 entries).
+ // CHECK-NEXT: 0 | void extended::D::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 12 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void extended::D::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 12 non-virtual]
// `vtordispex{8,8,4294967292,12}'
// MANGLING-DAG: @"\01?f@D@extended@@$R477PPPPPPPM@M@AEXXZ"
@@ -220,12 +262,17 @@
};
E e;
+void use(E *obj) { delete obj; }
struct F : virtual Z, virtual D {
- // VTABLE-EXTENDED-F: VFTable for 'V2' in 'extended::D' in 'extended::F' (2 entries).
- // VTABLE-EXTENDED-F-NEXT: 0 | void extended::D::f()
- // VTABLE-EXTENDED-F-NEXT: [this adjustment: vtordisp at -4, vbptr at 20 to the left,
- // VTABLE-EXTENDED-F-NEXT: vboffset at 12 in the vbtable, 12 non-virtual]
+ // CHECK-LABEL: VFTable for 'V2' in 'extended::D' in 'extended::F' (2 entries).
+ // CHECK-NEXT: 0 | void extended::D::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 20 to the left,
+ // CHECK-NEXT: vboffset at 12 in the vbtable, 12 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void extended::D::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 20 to the left,
+ // CHECK-NEXT: vboffset at 12 in the vbtable, 12 non-virtual]
// `vtordispex{20,12,4294967292,12}'
// MANGLING-DAG: @"\01?f@D@extended@@$R4BE@M@PPPPPPPM@M@AEXXZ"
@@ -235,17 +282,22 @@
};
F f;
+void use(F *obj) { delete obj; }
struct G : virtual simple::A {
- // VTABLE-EXTENDED-G: VFTable for 'extended::G' (1 entries).
- // VTABLE-EXTENDED-G-NEXT: 0 | void extended::G::g()
+ // CHECK-LABEL: VFTable for 'extended::G' (1 entry).
+ // CHECK-NEXT: 0 | void extended::G::g()
- // VTABLE-EXTENDED-G: VFTable for 'V1' in 'simple::A' in 'extended::G' (2 entries).
- // VTABLE-EXTENDED-G-NEXT: 0 | void simple::A::f()
- // VTABLE-EXTENDED-G-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
- // VTABLE-EXTENDED-G-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
- // VTABLE-EXTENDED-G-NEXT: 1 | extended::G::~G() [scalar deleting]
- // VTABLE-EXTENDED-G-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' in 'extended::G' (2 entries).
+ // CHECK-NEXT: 0 | void simple::A::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+ // CHECK-NEXT: 1 | extended::G::~G() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, 0 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
// Emits a G's own vfptr, thus moving the vbptr in the layout.
virtual void g();
@@ -256,22 +308,28 @@
};
G g;
+void use(G *obj) { obj->g(); }
struct H : Z, A {
- // VTABLE-EXTENDED-H: VFTable for 'Z' in 'extended::H' (2 entries).
- // VTABLE-EXTENDED-H-NEXT: 0 | void Z::g()
- // VTABLE-EXTENDED-H-NEXT: 1 | extended::H::~H() [scalar deleting]
+ // CHECK-LABEL: VFTable for 'Z' in 'extended::H' (2 entries).
+ // CHECK-NEXT: 0 | void Z::g()
+ // CHECK-NEXT: 1 | extended::H::~H() [scalar deleting]
- // VTABLE-EXTENDED-H: VFTable for 'V1' in 'simple::A' in 'extended::A' in 'extended::H' (2 entries).
- // VTABLE-EXTENDED-H-NEXT: 0 | void simple::A::f()
- // VTABLE-EXTENDED-H-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
- // VTABLE-EXTENDED-H-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+ // CHECK-LABEL: VFTable for 'V1' in 'simple::A' in 'extended::A' in 'extended::H' (2 entries).
+ // CHECK-NEXT: 0 | void simple::A::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::A::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -4, vbptr at 8 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 8 non-virtual]
// MANGLING-DAG: @"\01?f@A@simple@@$R477PPPPPPPM@7AEXXZ"
// MANGLING-DAG: @"\01??_EH@extended@@$4PPPPPPPM@BA@AEPAXI@Z"
};
H h;
+void use(H *obj) { delete obj; }
}
namespace pr17738 {
@@ -279,10 +337,14 @@
// Just do the right thing.
struct A : virtual simple::B {
- // VTABLE-PR17738-A: VFTable for 'V2' in 'V3' in 'simple::B' in 'pr17738::A' (2 entries).
- // VTABLE-PR17738-A-NEXT: 0 | void simple::B::f()
- // VTABLE-PR17738-A-NEXT: [this adjustment: vtordisp at -12, vbptr at 20 to the left,
- // VTABLE-PR17738-A-NEXT: vboffset at 8 in the vbtable, 16 non-virtual]
+ // CHECK-LABEL: VFTable for 'V2' in 'V3' in 'simple::B' in 'pr17738::A' (2 entries).
+ // CHECK-NEXT: 0 | void simple::B::f()
+ // CHECK-NEXT: [this adjustment: vtordisp at -12, vbptr at 20 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 16 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'void simple::B::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: vtordisp at -12, vbptr at 20 to the left,
+ // CHECK-NEXT: vboffset at 8 in the vbtable, 16 non-virtual]
// MANGLING-DAG: @"\01?f@B@simple@@$R4BE@7PPPPPPPE@BA@AEXXZ"
int a;
@@ -290,6 +352,7 @@
};
A a;
+void use(A *obj) { delete obj; }
}
namespace access {
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp b/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
index b58a0b1..1947b59 100644
--- a/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
@@ -1,29 +1,5 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm -o %t.ll -fdump-vtable-layouts %s -cxx-abi microsoft -triple=i386-pc-win32 >%t
-
-// RUN: FileCheck --check-prefix=VTABLE-C %s < %t
-// RUN: FileCheck --check-prefix=VTABLE-D %s < %t
-// RUN: FileCheck --check-prefix=TEST1 %s < %t
-// RUN: FileCheck --check-prefix=TEST2 %s < %t
-// RUN: FileCheck --check-prefix=TEST3 %s < %t
-// RUN: FileCheck --check-prefix=TEST4 %s < %t
-// RUN: FileCheck --check-prefix=TEST5 %s < %t
-// RUN: FileCheck --check-prefix=TEST6 %s < %t
-// RUN: FileCheck --check-prefix=TEST7 %s < %t
-// RUN: FileCheck --check-prefix=TEST8-X %s < %t
-// RUN: FileCheck --check-prefix=TEST8-Z %s < %t
-// RUN: FileCheck --check-prefix=TEST9-Y %s < %t
-// RUN: FileCheck --check-prefix=TEST9-Z %s < %t
-// RUN: FileCheck --check-prefix=TEST9-W %s < %t
-// RUN: FileCheck --check-prefix=TEST9-T %s < %t
-// RUN: FileCheck --check-prefix=TEST10 %s < %t
-// RUN: FileCheck --check-prefix=VDTORS-Y %s < %t
-// RUN: FileCheck --check-prefix=VDTORS-U %s < %t
-// RUN: FileCheck --check-prefix=VDTORS-V %s < %t
-// RUN: FileCheck --check-prefix=VDTORS-P %s < %t
-// RUN: FileCheck --check-prefix=RET-W %s < %t
-// RUN: FileCheck --check-prefix=RET-T %s < %t
-// RUN: FileCheck --check-prefix=RET-V %s < %t
-
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -o %t.ll -fdump-vtable-layouts %s -triple=i386-pc-win32 >%t
+// RUN: FileCheck %s < %t
// RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
struct Empty { };
@@ -38,34 +14,35 @@
};
struct C: virtual A {
- // VTABLE-C: VFTable for 'A' in 'C' (2 entries)
- // VTABLE-C-NEXT: 0 | void C::f()
- // VTABLE-C-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'C' (2 entries)
+ // CHECK-NEXT: 0 | void C::f()
+ // CHECK-NEXT: 1 | void A::z()
- // VTABLE-C: VFTable indices for 'C' (1 entries)
- // VTABLE-C-NEXT: vbtable index 1, vfptr at offset 0
- // VTABLE-C-NEXT: 0 | void C::f()
+ // CHECK-LABEL: VFTable indices for 'C' (1 entry)
+ // CHECK-NEXT: vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void C::f()
// MANGLING-DAG: @"\01??_7C@@6B@"
- virtual void f();
+ virtual void f() {}
};
C c;
+void use(C *obj) { obj->f(); }
struct D: virtual A {
- // VTABLE-D: VFTable for 'D' (1 entries).
- // VTABLE-D-NEXT: 0 | void D::h()
+ // CHECK-LABEL: VFTable for 'D' (1 entry).
+ // CHECK-NEXT: 0 | void D::h()
- // VTABLE-D: VFTable for 'A' in 'D' (2 entries).
- // VTABLE-D-NEXT: 0 | void D::f()
- // VTABLE-D-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'D' (2 entries).
+ // CHECK-NEXT: 0 | void D::f()
+ // CHECK-NEXT: 1 | void A::z()
- // VTABLE-D: VFTable indices for 'D' (2 entries).
- // VTABLE-D-NEXT: via vfptr at offset 0
- // VTABLE-D-NEXT: 0 | void D::h()
- // VTABLE-D-NEXT: via vbtable index 1, vfptr at offset 0
- // VTABLE-D-NEXT: 0 | void D::f()
+ // CHECK-LABEL: VFTable indices for 'D' (2 entries).
+ // CHECK-NEXT: via vfptr at offset 0
+ // CHECK-NEXT: 0 | void D::h()
+ // CHECK-NEXT: via vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void D::f()
// MANGLING-DAG: @"\01??_7D@@6B0@@"
// MANGLING-DAG: @"\01??_7D@@6BA@@@"
@@ -74,8 +51,8 @@
virtual void h();
};
-void D::h() {}
D d;
+void use(D *obj) { obj->h(); }
namespace Test1 {
@@ -86,33 +63,34 @@
// MANGLING-DAG: @"\01??_7Y@Test1@@6B@"
struct Z : virtual Y {
- // TEST1: VFTable for 'A' in 'Test1::Y' in 'Test1::Z' (2 entries).
- // TEST1-NEXT: 0 | void A::f()
- // TEST1-NEXT: 1 | void A::z()
+ Z();
+ // CHECK-LABEL: VFTable for 'A' in 'Test1::Y' in 'Test1::Z' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST1-NOT: VFTable indices for 'Test1::Z'
+ // CHECK-NOT: VFTable indices for 'Test1::Z'
// MANGLING-DAG: @"\01??_7Z@Test1@@6B@"
};
-Z z;
+Z::Z() {}
}
namespace Test2 {
struct X: virtual A, virtual B {
- // TEST2: VFTable for 'Test2::X' (1 entries).
- // TEST2-NEXT: 0 | void Test2::X::h()
+ // CHECK-LABEL: VFTable for 'Test2::X' (1 entry).
+ // CHECK-NEXT: 0 | void Test2::X::h()
- // TEST2: VFTable for 'A' in 'Test2::X' (2 entries).
- // TEST2-NEXT: 0 | void A::f()
- // TEST2-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'Test2::X' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST2: VFTable for 'B' in 'Test2::X' (1 entries).
- // TEST2-NEXT: 0 | void B::g()
+ // CHECK-LABEL: VFTable for 'B' in 'Test2::X' (1 entry).
+ // CHECK-NEXT: 0 | void B::g()
- // TEST2: VFTable indices for 'Test2::X' (1 entries).
- // TEST2-NEXT: 0 | void Test2::X::h()
+ // CHECK-LABEL: VFTable indices for 'Test2::X' (1 entry).
+ // CHECK-NEXT: 0 | void Test2::X::h()
// MANGLING-DAG: @"\01??_7X@Test2@@6B01@@"
// MANGLING-DAG: @"\01??_7X@Test2@@6BA@@@"
@@ -122,6 +100,7 @@
};
X x;
+void use(X *obj) { obj->h(); }
}
namespace Test3 {
@@ -131,32 +110,37 @@
};
struct Y: virtual X {
- // TEST3: VFTable for 'A' in 'Test3::X' in 'Test3::Y' (2 entries).
- // TEST3-NEXT: 0 | void A::f()
- // TEST3-NEXT: 1 | void A::z()
+ Y();
+ // CHECK-LABEL: VFTable for 'A' in 'Test3::X' in 'Test3::Y' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST3-NOT: VFTable indices for 'Test3::Y'
+ // CHECK-NOT: VFTable indices for 'Test3::Y'
// MANGLING-DAG: @"\01??_7Y@Test3@@6B@"
};
-Y y;
+Y::Y() {}
}
namespace Test4 {
struct X: virtual C {
+ X();
// This one's interesting. C::f expects (A*) to be passed as 'this' and does
// ECX-=4 to cast to (C*). In X, C and A vbases are reordered, so the thunk
// should pass a pointer to the end of X in order
// for ECX-=4 to point at the C part.
- // TEST4: VFTable for 'A' in 'C' in 'Test4::X' (2 entries).
- // TEST4-NEXT: 0 | void C::f()
- // TEST4-NEXT: [this adjustment: 8 non-virtual]
- // TEST4-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'C' in 'Test4::X' (2 entries).
+ // CHECK-NEXT: 0 | void C::f()
+ // CHECK-NEXT: [this adjustment: 8 non-virtual]
+ // CHECK-NEXT: 1 | void A::z()
- // TEST4-NOT: VFTable indices for 'Test4::X'
+ // CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: 8 non-virtual]
+
+ // CHECK-NOT: VFTable indices for 'Test4::X'
// MANGLING-DAG: @"\01??_7X@Test4@@6B@"
@@ -164,7 +148,7 @@
// MANGLING-DAG: define weak x86_thiscallcc void @"\01?f@C@@WPPPPPPPI@AEXXZ"
};
-X x;
+X::X() {}
}
namespace Test5 {
@@ -176,16 +160,16 @@
};
struct Y : virtual X {
- // TEST5: VFTable for 'Test5::Y' (1 entries).
- // TEST5-NEXT: 0 | void Test5::Y::h()
+ // CHECK-LABEL: VFTable for 'Test5::Y' (1 entry).
+ // CHECK-NEXT: 0 | void Test5::Y::h()
- // TEST5: VFTable for 'A' in 'Test5::X' in 'Test5::Y' (3 entries).
- // TEST5-NEXT: 0 | void A::f()
- // TEST5-NEXT: 1 | void A::z()
- // TEST5-NEXT: 2 | void Test5::X::g()
+ // CHECK-LABEL: VFTable for 'A' in 'Test5::X' in 'Test5::Y' (3 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
+ // CHECK-NEXT: 2 | void Test5::X::g()
- // TEST5: VFTable indices for 'Test5::Y' (1 entries).
- // TEST5-NEXT: 0 | void Test5::Y::h()
+ // CHECK-LABEL: VFTable indices for 'Test5::Y' (1 entry).
+ // CHECK-NEXT: 0 | void Test5::Y::h()
// MANGLING-DAG: @"\01??_7Y@Test5@@6B01@@"
// MANGLING-DAG: @"\01??_7Y@Test5@@6BX@1@@"
@@ -194,21 +178,23 @@
};
Y y;
+void use(Y *obj) { obj->h(); }
}
namespace Test6 {
struct X : A, virtual Empty {
- // TEST6: VFTable for 'A' in 'Test6::X' (2 entries).
- // TEST6-NEXT: 0 | void A::f()
- // TEST6-NEXT: 1 | void A::z()
+ X();
+ // CHECK-LABEL: VFTable for 'A' in 'Test6::X' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST6-NOT: VFTable indices for 'Test6::X'
+ // CHECK-NOT: VFTable indices for 'Test6::X'
// MANGLING-DAG: @"\01??_7X@Test6@@6B@"
};
-X x;
+X::X() {}
}
namespace Test7 {
@@ -218,36 +204,37 @@
};
struct Y : virtual X {
- // TEST7: VFTable for 'A' in 'C' in 'Test7::X' in 'Test7::Y' (2 entries).
- // TEST7-NEXT: 0 | void C::f()
- // TEST7-NEXT: [this adjustment: 8 non-virtual]
- // TEST7-NEXT: 1 | void A::z()
+ Y();
+ // CHECK-LABEL: VFTable for 'A' in 'C' in 'Test7::X' in 'Test7::Y' (2 entries).
+ // CHECK-NEXT: 0 | void C::f()
+ // CHECK-NEXT: [this adjustment: 8 non-virtual]
+ // CHECK-NEXT: 1 | void A::z()
- // TEST7: Thunks for 'void C::f()' (1 entry).
- // TEST7-NEXT: 0 | [this adjustment: 8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: 8 non-virtual]
- // TEST7-NOT: VFTable indices for 'Test7::Y'
+ // CHECK-NOT: VFTable indices for 'Test7::Y'
// MANGLING-DAG: @"\01??_7Y@Test7@@6B@"
};
-Y y;
+Y::Y() {}
}
namespace Test8 {
// This is a typical diamond inheritance with a shared 'A' vbase.
struct X : D, C {
- // TEST8-X: VFTable for 'D' in 'Test8::X' (1 entries).
- // TEST8-X-NEXT: 0 | void D::h()
+ // CHECK-LABEL: VFTable for 'D' in 'Test8::X' (1 entry).
+ // CHECK-NEXT: 0 | void D::h()
- // TEST8-X: VFTable for 'A' in 'D' in 'Test8::X' (2 entries).
- // TEST8-X-NEXT: 0 | void Test8::X::f()
- // TEST8-X-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'D' in 'Test8::X' (2 entries).
+ // CHECK-NEXT: 0 | void Test8::X::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST8-X: VFTable indices for 'Test8::X' (1 entries).
- // TEST8-X-NEXT: via vbtable index 1, vfptr at offset 0
- // TEST8-X-NEXT: 0 | void Test8::X::f()
+ // CHECK-LABEL: VFTable indices for 'Test8::X' (1 entry).
+ // CHECK-NEXT: via vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test8::X::f()
// MANGLING-DAG: @"\01??_7X@Test8@@6BA@@@"
// MANGLING-DAG: @"\01??_7X@Test8@@6BD@@@"
@@ -256,21 +243,45 @@
};
X x;
+void use(X *obj) { obj->f(); }
// Another diamond inheritance which led to AST crashes.
struct Y : virtual A {};
-class Z : Y, C {
- // TEST8-Z: VFTable for 'A' in 'Test8::Y' in 'Test8::Z' (2 entries).
- // TEST8-Z-NEXT: 0 | void Test8::Z::f()
- // TEST8-Z-NEXT: 1 | void A::z()
+struct Z : Y, C {
+ // CHECK-LABEL: VFTable for 'A' in 'Test8::Y' in 'Test8::Z' (2 entries).
+ // CHECK-NEXT: 0 | void Test8::Z::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST8-Z: VFTable indices for 'Test8::Z' (1 entries).
- // TEST8-Z-NEXT: via vbtable index 1, vfptr at offset 0
- // TEST8-Z-NEXT: 0 | void Test8::Z::f()
+ // CHECK-LABEL: VFTable indices for 'Test8::Z' (1 entry).
+ // CHECK-NEXT: via vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test8::Z::f()
virtual void f();
};
Z z;
+void use(Z *obj) { obj->f(); }
+
+// Another diamond inheritance which we miscompiled (PR18967).
+struct W : virtual A {
+ virtual void bar();
+};
+
+struct T : W, C {
+ // CHECK-LABEL: VFTable for 'Test8::W' in 'Test8::T' (1 entry)
+ // CHECK-NEXT: 0 | void Test8::T::bar()
+
+ // CHECK-LABEL: VFTable for 'A' in 'Test8::W' in 'Test8::T' (2 entries)
+ // CHECK-NEXT: 0 | void C::f()
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 1 | void A::z()
+
+ // CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
+ virtual void bar();
+ int field;
+};
+T t;
+void use(T *obj) { obj->bar(); }
}
namespace Test9 {
@@ -278,15 +289,15 @@
struct X : A { };
struct Y : virtual X {
- // TEST9-Y: VFTable for 'Test9::Y' (1 entries).
- // TEST9-Y-NEXT: 0 | void Test9::Y::h()
+ // CHECK-LABEL: VFTable for 'Test9::Y' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::Y::h()
- // TEST9-Y: VFTable for 'A' in 'Test9::X' in 'Test9::Y' (2 entries).
- // TEST9-Y-NEXT: 0 | void A::f()
- // TEST9-Y-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST9-Y: VFTable indices for 'Test9::Y' (1 entries).
- // TEST9-Y-NEXT: 0 | void Test9::Y::h()
+ // CHECK-LABEL: VFTable indices for 'Test9::Y' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::Y::h()
// MANGLING-DAG: @"\01??_7Y@Test9@@6B01@@"
// MANGLING-DAG: @"\01??_7Y@Test9@@6BX@1@@"
@@ -295,115 +306,110 @@
};
Y y;
+void use(Y *obj) { obj->h(); }
struct Z : Y, virtual B {
- // TEST9-Z: VFTable for 'Test9::Y' in 'Test9::Z' (1 entries).
- // TEST9-Z-NEXT: 0 | void Test9::Y::h()
+ Z();
+ // CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::Y::h()
- // TEST9-Z: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' (2 entries).
- // TEST9-Z-NEXT: 0 | void A::f()
- // TEST9-Z-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST9-Z: VFTable for 'B' in 'Test9::Z' (1 entries).
- // TEST9-Z-NEXT: 0 | void B::g()
+ // CHECK-LABEL: VFTable for 'B' in 'Test9::Z' (1 entry).
+ // CHECK-NEXT: 0 | void B::g()
- // TEST9-Z-NOT: VFTable indices for 'Test9::Z'
+ // CHECK-NOT: VFTable indices for 'Test9::Z'
// MANGLING-DAG: @"\01??_7Z@Test9@@6BX@1@@"
// MANGLING-DAG: @"\01??_7Z@Test9@@6BY@1@@"
- // FIXME this one is wrong:
- // INCORRECT MANGLING-DAG: @"\01??_7Z@Test9@@6BB@@@"
- // MANGLING-DAG-SHOULD-BE: @"\01??_7Z@Test9@@6B@"
+ // MANGLING-DAG: @"\01??_7Z@Test9@@6B@"
};
-Z z;
+Z::Z() {}
struct W : Z, D, virtual A, virtual B {
- // TEST9-W: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::W' (1 entries).
- // TEST9-W-NEXT: 0 | void Test9::Y::h()
+ W();
+ // CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::W' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::Y::h()
- // TEST9-W: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::W' (2 entries).
- // TEST9-W-NEXT: 0 | void A::f()
- // TEST9-W-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::W' (2 entries).
+ // CHECK-NEXT: 0 | void A::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST9-W: VFTable for 'B' in 'Test9::Z' in 'Test9::W' (1 entries).
- // TEST9-W-NEXT: 0 | void B::g()
+ // CHECK-LABEL: VFTable for 'B' in 'Test9::Z' in 'Test9::W' (1 entry).
+ // CHECK-NEXT: 0 | void B::g()
- // TEST9-W: VFTable for 'D' in 'Test9::W' (1 entries).
- // TEST9-W-NEXT: 0 | void D::h()
+ // CHECK-LABEL: VFTable for 'D' in 'Test9::W' (1 entry).
+ // CHECK-NEXT: 0 | void D::h()
- // TEST9-W: VFTable for 'A' in 'D' in 'Test9::W' (2 entries).
- // TEST9-W-NEXT: 0 | void D::f()
- // TEST9-W-NEXT: [this adjustment: -8 non-virtual]
- // TEST9-W-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'D' in 'Test9::W' (2 entries).
+ // CHECK-NEXT: 0 | void D::f()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-NEXT: 1 | void A::z()
- // TEST9-W: Thunks for 'void D::f()' (1 entry).
- // TEST9-W-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void D::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // TEST9-W-NOT: VFTable indices for 'Test9::W'
+ // CHECK-NOT: VFTable indices for 'Test9::W'
// MANGLING-DAG: @"\01??_7W@Test9@@6BA@@@"
// MANGLING-DAG: @"\01??_7W@Test9@@6BD@@@"
// MANGLING-DAG: @"\01??_7W@Test9@@6BX@1@@"
- // FIXME: these two are wrong:
- // INCORRECT MANGLING-DAG: @"\01??_7W@Test9@@6BB@@@"
- // MANGLING-DAG-SHOULD-BE: @"\01??_7W@Test9@@6B@"
- // INCORRECT MANGLING-DAG: @"\01??_7W@Test9@@6BY@1@Z@1@@"
- // MANGLING-DAG-SHOULD-BE: @"\01??_7W@Test9@@6BY@1@@"
+ // MANGLING-DAG: @"\01??_7W@Test9@@6B@"
+ // MANGLING-DAG: @"\01??_7W@Test9@@6BY@1@@"
};
-W w;
+W::W() {}
struct T : Z, D, virtual A, virtual B {
- // TEST9-T: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::T' (1 entries).
- // TEST9-T-NEXT: 0 | void Test9::T::h()
+ // CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::T' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::T::h()
- // TEST9-T: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::T' (2 entries).
- // TEST9-T-NEXT: 0 | void Test9::T::f()
- // TEST9-T-NEXT: 1 | void Test9::T::z()
+ // CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::T' (2 entries).
+ // CHECK-NEXT: 0 | void Test9::T::f()
+ // CHECK-NEXT: 1 | void Test9::T::z()
- // TEST9-T: VFTable for 'B' in 'Test9::Z' in 'Test9::T' (1 entries).
- // TEST9-T-NEXT: 0 | void Test9::T::g()
+ // CHECK-LABEL: VFTable for 'B' in 'Test9::Z' in 'Test9::T' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::T::g()
- // TEST9-T: VFTable for 'D' in 'Test9::T' (1 entries).
- // TEST9-T-NEXT: 0 | void Test9::T::h()
- // TEST9-T-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: VFTable for 'D' in 'Test9::T' (1 entry).
+ // CHECK-NEXT: 0 | void Test9::T::h()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
- // TEST9-T: Thunks for 'void Test9::T::h()' (1 entry).
- // TEST9-T-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void Test9::T::h()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // TEST9-T: VFTable for 'A' in 'D' in 'Test9::T' (2 entries).
- // TEST9-T-NEXT: 0 | void Test9::T::f()
- // TEST9-T-NEXT: [this adjustment: -8 non-virtual]
- // TEST9-T-NEXT: 1 | void Test9::T::z()
- // TEST9-T-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: VFTable for 'A' in 'D' in 'Test9::T' (2 entries).
+ // CHECK-NEXT: 0 | void Test9::T::f()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
+ // CHECK-NEXT: 1 | void Test9::T::z()
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
- // TEST9-T: Thunks for 'void Test9::T::f()' (1 entry).
- // TEST9-T-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void Test9::T::f()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // TEST9-T: Thunks for 'void Test9::T::z()' (1 entry).
- // TEST9-T-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: Thunks for 'void Test9::T::z()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
- // TEST9-T: VFTable indices for 'Test9::T' (4 entries).
- // TEST9-T-NEXT: via vfptr at offset 0
- // TEST9-T-NEXT: 0 | void Test9::T::h()
- // TEST9-T-NEXT: via vbtable index 1, vfptr at offset 0
- // TEST9-T-NEXT: 0 | void Test9::T::f()
- // TEST9-T-NEXT: 1 | void Test9::T::z()
- // TEST9-T-NEXT: via vbtable index 2, vfptr at offset 0
- // TEST9-T-NEXT: 0 | void Test9::T::g()
+ // CHECK-LABEL: VFTable indices for 'Test9::T' (4 entries).
+ // CHECK-NEXT: via vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test9::T::h()
+ // CHECK-NEXT: via vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test9::T::f()
+ // CHECK-NEXT: 1 | void Test9::T::z()
+ // CHECK-NEXT: via vbtable index 2, vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test9::T::g()
// MANGLING-DAG: @"\01??_7T@Test9@@6BA@@@"
// MANGLING-DAG: @"\01??_7T@Test9@@6BD@@@"
// MANGLING-DAG: @"\01??_7T@Test9@@6BX@1@@"
- // FIXME: these two are wrong:
- // INCORRECT MANGLING-DAG: @"\01??_7T@Test9@@6BB@@@"
- // MANGLING-DAG-SHOULD-BE: @"\01??_7T@Test9@@6B@"
- // INCORRECT MANGLING-DAG: @"\01??_7T@Test9@@6BY@1@Z@1@@"
- // MANGLING-DAG-SHOULD-BE: @"\01??_7T@Test9@@6BY@1@@"
+ // MANGLING-DAG: @"\01??_7T@Test9@@6B@"
+ // MANGLING-DAG: @"\01??_7T@Test9@@6BY@1@@"
virtual void f();
virtual void g();
@@ -412,22 +418,41 @@
};
T t;
+void use(T *obj) { obj->f(); }
}
namespace Test10 {
struct X : virtual C, virtual A {
- // TEST10: VFTable for 'A' in 'C' in 'Test10::X' (2 entries).
- // TEST10-NEXT: 0 | void Test10::X::f()
- // TEST10-NEXT: 1 | void A::z()
+ // CHECK-LABEL: VFTable for 'A' in 'C' in 'Test10::X' (2 entries).
+ // CHECK-NEXT: 0 | void Test10::X::f()
+ // CHECK-NEXT: 1 | void A::z()
- // TEST10: VFTable indices for 'Test10::X' (1 entries).
- // TEST10-NEXT: via vbtable index 1, vfptr at offset 0
- // TEST10-NEXT: 0 | void Test10::X::f()
+ // CHECK-LABEL: VFTable indices for 'Test10::X' (1 entry).
+ // CHECK-NEXT: via vbtable index 1, vfptr at offset 0
+ // CHECK-NEXT: 0 | void Test10::X::f()
virtual void f();
};
void X::f() {}
X x;
+void use(X *obj) { obj->f(); }
+}
+
+namespace Test11 {
+struct X : virtual A {};
+struct Y { virtual void g(); };
+
+struct Z : virtual X, Y {
+ // MANGLING-DAG: @"\01??_7Z@Test11@@6BY@1@@"
+ // MANGLING-DAG: @"\01??_7Z@Test11@@6BX@1@@"
+};
+
+Z z;
+
+struct W : virtual X, A {};
+
+// Used to crash, PR17748.
+W w;
}
namespace vdtors {
@@ -437,15 +462,16 @@
};
struct Y : virtual X {
- // VDTORS-Y: VFTable for 'vdtors::X' in 'vdtors::Y' (2 entries).
- // VDTORS-Y-NEXT: 0 | vdtors::Y::~Y() [scalar deleting]
- // VDTORS-Y-NEXT: 1 | void vdtors::X::zzz()
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::Y' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::Y::~Y() [scalar deleting]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
- // VDTORS-Y-NOT: Thunks for 'vdtors::Y::~Y()'
+ // CHECK-NOT: Thunks for 'vdtors::Y::~Y()'
virtual ~Y();
};
Y y;
+void use(Y *obj) { delete obj; }
struct Z {
virtual void z();
@@ -456,59 +482,86 @@
};
struct U : virtual W {
- // VDTORS-U: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::U' (1 entries).
- // VDTORS-U-NEXT: 0 | void vdtors::Z::z()
+ // CHECK-LABEL: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::U' (1 entry).
+ // CHECK-NEXT: 0 | void vdtors::Z::z()
- // VDTORS-U: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::U' (2 entries).
- // VDTORS-U-NEXT: 0 | vdtors::U::~U() [scalar deleting]
- // VDTORS-U-NEXT: [this adjustment: -4 non-virtual]
- // VDTORS-U-NEXT: 1 | void vdtors::X::zzz()
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::U' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::U::~U() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
- // VDTORS-U: Thunks for 'vdtors::W::~W()' (1 entry).
- // VDTORS-U-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtors::U::~U()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTORS-U: VFTable indices for 'vdtors::U' (1 entries).
- // VDTORS-U-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
- // VDTORS-U-NEXT: 0 | vdtors::U::~U() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtors::U' (1 entry).
+ // CHECK-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
+ // CHECK-NEXT: 0 | vdtors::U::~U() [scalar deleting]
virtual ~U();
};
U u;
+void use(U *obj) { delete obj; }
struct V : virtual W {
- // VDTORS-V: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::V' (1 entries).
- // VDTORS-V-NEXT: 0 | void vdtors::Z::z()
+ // CHECK-LABEL: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::V' (1 entry).
+ // CHECK-NEXT: 0 | void vdtors::Z::z()
- // VDTORS-V: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::V' (2 entries).
- // VDTORS-V-NEXT: 0 | vdtors::V::~V() [scalar deleting]
- // VDTORS-V-NEXT: [this adjustment: -4 non-virtual]
- // VDTORS-V-NEXT: 1 | void vdtors::X::zzz()
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::V' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::V::~V() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -4 non-virtual]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
- // VDTORS-V: Thunks for 'vdtors::W::~W()' (1 entry).
- // VDTORS-V-NEXT: 0 | [this adjustment: -4 non-virtual]
+ // CHECK-LABEL: Thunks for 'vdtors::V::~V()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
- // VDTORS-V: VFTable indices for 'vdtors::V' (1 entries).
- // VDTORS-V-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
- // VDTORS-V-NEXT: 0 | vdtors::V::~V() [scalar deleting]
+ // CHECK-LABEL: VFTable indices for 'vdtors::V' (1 entry).
+ // CHECK-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
+ // CHECK-NEXT: 0 | vdtors::V::~V() [scalar deleting]
};
V v;
+void use(V *obj) { delete obj; }
struct T : virtual X {
virtual ~T();
};
struct P : T, Y {
- // VDTORS-P: VFTable for 'vdtors::X' in 'vdtors::T' in 'vdtors::P' (2 entries).
- // VDTORS-P-NEXT: 0 | vdtors::P::~P() [scalar deleting]
- // VDTORS-P-NEXT: 1 | void vdtors::X::zzz()
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::T' in 'vdtors::P' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::P::~P() [scalar deleting]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
- // VDTORS-P-NOT: Thunks for 'vdtors::P::~P()'
+ // CHECK-NOT: Thunks for 'vdtors::P::~P()'
virtual ~P();
};
P p;
+void use(P *obj) { delete obj; }
+struct Q {
+ virtual ~Q();
+};
+
+// PR19172: Yet another diamond we miscompiled.
+struct R : virtual Q, X {
+ // CHECK-LABEL: VFTable for 'vdtors::Q' in 'vdtors::R' (1 entry).
+ // CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
+ // CHECK-NEXT: [this adjustment: -8 non-virtual]
+
+ // CHECK-LABEL: Thunks for 'vdtors::R::~R()' (1 entry).
+ // CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
+
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::R' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
+
+ // CHECK-LABEL: VFTable indices for 'vdtors::R' (1 entry).
+ // CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
+ virtual ~R();
+};
+
+R r;
+void use(R *obj) { delete obj; }
}
namespace return_adjustment {
@@ -526,50 +579,121 @@
};
struct W : Z {
- // RET-W: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' (2 entries).
- // RET-W-NEXT: 0 | return_adjustment::X *return_adjustment::W::foo()
- // RET-W-NEXT: [return adjustment: vbase #1, 0 non-virtual]
- // RET-W-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' (2 entries).
+ // CHECK-NEXT: 0 | return_adjustment::X *return_adjustment::W::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
+ // CHECK-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
- // RET-W: VFTable indices for 'return_adjustment::W' (1 entries).
- // RET-W-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::X *return_adjustment::W::foo()' (1 entry).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::W' (1 entry).
+ // CHECK-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
virtual X* foo();
};
-W y;
+W w;
+void use(W *obj) { obj->foo(); }
struct T : W {
- // RET-T: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' in 'return_adjustment::T' (3 entries).
- // RET-T-NEXT: 0 | return_adjustment::Y *return_adjustment::T::foo()
- // RET-T-NEXT: [return adjustment: vbase #1, 0 non-virtual]
- // RET-T-NEXT: 1 | return_adjustment::Y *return_adjustment::T::foo()
- // RET-T-NEXT: [return adjustment: vbase #2, 0 non-virtual]
- // RET-T-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' in 'return_adjustment::T' (3 entries).
+ // CHECK-NEXT: 0 | return_adjustment::Y *return_adjustment::T::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
+ // CHECK-NEXT: 1 | return_adjustment::Y *return_adjustment::T::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct return_adjustment::X *'): vbase #2, 0 non-virtual]
+ // CHECK-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
- // RET-T: VFTable indices for 'return_adjustment::T' (1 entries).
- // RET-T-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::Y *return_adjustment::T::foo()' (2 entries).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
+ // CHECK-NEXT: 1 | [return adjustment (to type 'struct return_adjustment::X *'): vbase #2, 0 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::T' (1 entry).
+ // CHECK-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
virtual Y* foo();
};
T t;
+void use(T *obj) { obj->foo(); }
struct U : virtual A {
virtual void g(); // adds a vfptr
};
struct V : Z {
- // RET-V: VFTable for 'return_adjustment::Z' in 'return_adjustment::V' (2 entries).
- // RET-V-NEXT: 0 | return_adjustment::U *return_adjustment::V::foo()
- // RET-V-NEXT: [return adjustment: vbptr at offset 4, vbase #1, 0 non-virtual]
- // RET-V-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
+ // CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::V' (2 entries).
+ // CHECK-NEXT: 0 | return_adjustment::U *return_adjustment::V::foo()
+ // CHECK-NEXT: [return adjustment (to type 'struct A *'): vbptr at offset 4, vbase #1, 0 non-virtual]
+ // CHECK-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
- // RET-V: VFTable indices for 'return_adjustment::V' (1 entries).
- // RET-V-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
+ // CHECK-LABEL: Thunks for 'return_adjustment::U *return_adjustment::V::foo()' (1 entry).
+ // CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbptr at offset 4, vbase #1, 0 non-virtual]
+
+ // CHECK-LABEL: VFTable indices for 'return_adjustment::V' (1 entry).
+ // CHECK-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
virtual U* foo();
};
V v;
+void use(V *obj) { obj->foo(); }
+}
+
+namespace pr17748 {
+struct A {
+ virtual void f() {}
+};
+
+struct B : virtual A {
+ B() {}
+};
+
+struct C : virtual B, A {
+ C() {}
+};
+C c;
+
+// MANGLING-DAG: @"\01??_7A@pr17748@@6B@"
+// MANGLING-DAG: @"\01??_7B@pr17748@@6B@"
+// MANGLING-DAG: @"\01??_7C@pr17748@@6BA@1@@"
+// MANGLING-DAG: @"\01??_7C@pr17748@@6BB@1@@"
+}
+
+namespace pr19066 {
+struct X : virtual B {};
+
+struct Y : virtual X, B {
+ Y();
+ // CHECK-LABEL: VFTable for 'B' in 'pr19066::X' in 'pr19066::Y' (1 entry).
+ // CHECK-NEXT: 0 | void B::g()
+
+ // CHECK-LABEL: VFTable for 'B' in 'pr19066::Y' (1 entry).
+ // CHECK-NEXT: 0 | void B::g()
+};
+
+Y::Y() {}
+}
+
+namespace pr19240 {
+struct A {
+ virtual void c();
+};
+
+struct B : virtual A {
+ virtual void c();
+};
+
+struct C { };
+
+struct D : virtual A, virtual C, B {};
+
+D obj;
+
+// Each MDC only has one vftable.
+
+// MANGLING-DAG: @"\01??_7D@pr19240@@6B@"
+// MANGLING-DAG: @"\01??_7A@pr19240@@6B@"
+// MANGLING-DAG: @"\01??_7B@pr19240@@6B@"
+
}
diff --git a/test/CodeGenCXX/microsoft-interface.cpp b/test/CodeGenCXX/microsoft-interface.cpp
index 419075a..c030d1d 100644
--- a/test/CodeGenCXX/microsoft-interface.cpp
+++ b/test/CodeGenCXX/microsoft-interface.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft -triple=i386-pc-win32 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft -triple=i386-pc-windows-gnu -emit-llvm %s -o - | FileCheck %s
__interface I {
int test() {
@@ -20,24 +20,21 @@
// CHECK: @_ZTV1S = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI1S to i8*), i8* bitcast (i32 (%struct.S*)* @_ZN1S4testEv to i8*)]
// CHECK-LABEL: define i32 @_Z2fnv()
-// CHECK: call void @_ZN1SC1Ev(%struct.S* %s)
-// CHECK: %{{[.0-9A-Z_a-z]+}} = call i32 @_ZN1S4testEv(%struct.S* %s)
+// CHECK: call x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %s)
+// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %s)
-// CHECK-LABEL: define linkonce_odr void @_ZN1SC1Ev(%struct.S* %this)
-// CHECK: call void @_ZN1SC2Ev(%struct.S* %{{[.0-9A-Z_a-z]+}})
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %this)
+// CHECK: call x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %{{[.0-9A-Z_a-z]+}})
-// CHECK-LABEL: define linkonce_odr i32 @_ZN1S4testEv(%struct.S* %this)
-// CHECK: %{{[.0-9A-Z_a-z]+}} = call i32 @_ZN1I4testEv(%__interface.I* %{{[.0-9A-Z_a-z]+}})
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %this)
+// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %{{[.0-9A-Z_a-z]+}})
-// CHECK-LABEL: define linkonce_odr i32 @_ZN1I4testEv(%__interface.I* %this)
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %this)
// CHECK: ret i32 1
-// CHECK-LABEL: define linkonce_odr void @_ZN1SC2Ev(%struct.S* %this)
-// CHECK: call void @_ZN1IC2Ev(%__interface.I* %{{[.0-9A-Z_a-z]+}})
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %this)
+// CHECK: call x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %{{[.0-9A-Z_a-z]+}})
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1S, i64 0, i64 2), i8*** %{{[.0-9A-Z_a-z]+}}
-// CHECK-LABEL: define linkonce_odr void @_ZN1IC2Ev(%__interface.I* %this)
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %this)
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1I, i64 0, i64 2), i8*** %{{[.0-9A-Z_a-z]+}}
-
-// CHECK-NOT-LABEL: define linkonce_odr %__interface.I* @_ZN1IaSERKS_(%__interface.I* %this, %__interface.I*)
-// CHECK-NOT-LABEL: define linkonce_odr %__interface.I* @_ZN1IaSEOS_(%__interface.I* %this, %__interface.I*)
diff --git a/test/CodeGenCXX/microsoft-new.cpp b/test/CodeGenCXX/microsoft-new.cpp
index 48e93d4..7857e47 100644
--- a/test/CodeGenCXX/microsoft-new.cpp
+++ b/test/CodeGenCXX/microsoft-new.cpp
@@ -1,39 +1,39 @@
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s
-
-#include <stddef.h>
-
-struct arbitrary_t {} arbitrary;
-void *operator new(size_t size, arbitrary_t);
-
-struct arbitrary2_t {} arbitrary2;
-void *operator new[](size_t size, arbitrary2_t);
-
-namespace PR13164 {
- void f() {
- // MSVC will fall back on the non-array operator new.
- void *a;
- int *p = new(arbitrary) int[4];
- // CHECK: call i8* @_Znwj11arbitrary_t(i32 16, %struct.arbitrary_t*
- }
-
- struct S {
- void *operator new[](size_t size, arbitrary_t);
- };
-
- void g() {
- S *s = new(arbitrary) S[2];
- // CHECK: call i8* @_ZN7PR131641SnaEj11arbitrary_t(i32 2, %struct.arbitrary_t*
- S *s1 = new(arbitrary) S;
- // CHECK: call i8* @_Znwj11arbitrary_t(i32 1, %struct.arbitrary_t*
- }
-
- struct T {
- void *operator new(size_t size, arbitrary2_t);
- };
-
- void h() {
- // This should still call the global operator new[].
- T *t = new(arbitrary2) T[2];
- // CHECK: call i8* @_Znaj12arbitrary2_t(i32 2, %struct.arbitrary2_t*
- }
-}
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s
+
+#include <stddef.h>
+
+struct arbitrary_t {} arbitrary;
+void *operator new(size_t size, arbitrary_t);
+
+struct arbitrary2_t {} arbitrary2;
+void *operator new[](size_t size, arbitrary2_t);
+
+namespace PR13164 {
+ void f() {
+ // MSVC will fall back on the non-array operator new.
+ void *a;
+ int *p = new(arbitrary) int[4];
+ // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t*
+ }
+
+ struct S {
+ void *operator new[](size_t size, arbitrary_t);
+ };
+
+ void g() {
+ S *s = new(arbitrary) S[2];
+ // CHECK: call i8* @"\01??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t*
+ S *s1 = new(arbitrary) S;
+ // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t*
+ }
+
+ struct T {
+ void *operator new(size_t size, arbitrary2_t);
+ };
+
+ void h() {
+ // This should still call the global operator new[].
+ T *t = new(arbitrary2) T[2];
+ // CHECK: call i8* @"\01??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t*
+ }
+}
diff --git a/test/CodeGenCXX/microsoft-uuidof.cpp b/test/CodeGenCXX/microsoft-uuidof.cpp
index ab3d9b6..d57ca83 100644
--- a/test/CodeGenCXX/microsoft-uuidof.cpp
+++ b/test/CodeGenCXX/microsoft-uuidof.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -triple=i386-pc-win32 -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-GUID
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fms-extensions | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -DWRONG_GUID -triple=i386-pc-win32 -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-WRONG-GUID
+// RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -triple=i386-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-GUID
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux -fms-extensions | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -DWRONG_GUID -triple=i386-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-WRONG-GUID
#ifdef DEFINE_GUID
struct _GUID {
diff --git a/test/CodeGenCXX/mingw-new-abi.cpp b/test/CodeGenCXX/mingw-new-abi.cpp
new file mode 100644
index 0000000..2b05253
--- /dev/null
+++ b/test/CodeGenCXX/mingw-new-abi.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -triple i386-pc-mingw32 %s -o - | FileCheck --check-prefix=MINGW %s
+// RUN: %clang_cc1 -emit-llvm -triple i386-pc-cygwin %s -o - | FileCheck --check-prefix=CYGWIN %s
+
+namespace test1 {
+ struct foo {
+ // MINGW: declare x86_thiscallcc void @_ZN5test13foo1fEv
+ // CYGWIN: declare void @_ZN5test13foo1fEv
+ void f();
+ };
+ void g(foo *x) {
+ x->f();
+ }
+}
diff --git a/test/CodeGenCXX/ms-integer-static-data-members.cpp b/test/CodeGenCXX/ms-integer-static-data-members.cpp
index 00beaa6..5505db1 100644
--- a/test/CodeGenCXX/ms-integer-static-data-members.cpp
+++ b/test/CodeGenCXX/ms-integer-static-data-members.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -cxx-abi microsoft -triple=i386-pc-win32 %s -o - | FileCheck %s
-// RUN: %clang_cc1 -DINLINE_INIT -emit-llvm -cxx-abi microsoft -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-INLINE
-// RUN: %clang_cc1 -DREAL_DEFINITION -emit-llvm -cxx-abi microsoft -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-OUTOFLINE
-// RUN: %clang_cc1 -DINLINE_INIT -DREAL_DEFINITION -emit-llvm -cxx-abi microsoft -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-INLINE
+// RUN: %clang_cc1 -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -DINLINE_INIT -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-INLINE
+// RUN: %clang_cc1 -DREAL_DEFINITION -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-OUTOFLINE
+// RUN: %clang_cc1 -DINLINE_INIT -DREAL_DEFINITION -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK-INLINE
struct S {
// For MS ABI, we emit a linkonce_odr definition here, even though it's really just a declaration.
diff --git a/test/CodeGenCXX/ms_wide_predefined_expr.cpp b/test/CodeGenCXX/ms_wide_predefined_expr.cpp
index 5f0bcde..b6af519 100644
--- a/test/CodeGenCXX/ms_wide_predefined_expr.cpp
+++ b/test/CodeGenCXX/ms_wide_predefined_expr.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -fms-extensions -triple i686-pc-win32 -emit-llvm -o - | FileCheck %s
-// CHECK: @L__FUNCTION__._Z4funcv = private constant [5 x i16] [i16 102, i16 117, i16 110, i16 99, i16 0], align 2
+// CHECK: @"L__FUNCTION__.?func@@YAXXZ" = private constant [5 x i16] [i16 102, i16 117, i16 110, i16 99, i16 0], align 2
void wprint(const wchar_t*);
diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp
index 91da77a..26db842 100644
--- a/test/CodeGenCXX/new.cpp
+++ b/test/CodeGenCXX/new.cpp
@@ -285,7 +285,7 @@
namespace N3664 {
struct S { S() throw(int); };
- // CHECK-LABEL-LABEL: define void @_ZN5N36641fEv
+ // CHECK-LABEL: define void @_ZN5N36641fEv
void f() {
// CHECK: call noalias i8* @_Znwm(i64 4) [[ATTR_BUILTIN_NEW:#[^ ]*]]
int *p = new int;
@@ -307,7 +307,7 @@
// FIXME: Can we mark this noalias?
// CHECK: declare i8* @_ZnamRKSt9nothrow_t(i64, {{.*}}) [[ATTR_NOBUILTIN_NOUNWIND]]
- // CHECK-LABEL-LABEL: define void @_ZN5N36641gEv
+ // CHECK-LABEL: define void @_ZN5N36641gEv
void g() {
// It's OK for there to be attributes here, so long as we don't have a
// 'builtin' attribute.
diff --git a/test/CodeGenCXX/no-elide-constructors.cpp b/test/CodeGenCXX/no-elide-constructors.cpp
new file mode 100644
index 0000000..ecb350f
--- /dev/null
+++ b/test/CodeGenCXX/no-elide-constructors.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++98 -triple i386-unknown-unknown -fno-elide-constructors -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CXX98
+// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown -fno-elide-constructors -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CXX11
+// RUN: %clang_cc1 -std=c++98 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CXX98-ELIDE
+// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CXX11-ELIDE
+
+// Reduced from PR12208
+class X {
+public:
+ X();
+ X(const X&);
+#if __cplusplus >= 201103L
+ X(X&&);
+#endif
+ ~X();
+};
+
+// CHECK-LABEL: define void @_Z4Testv(
+X Test()
+{
+ X x;
+
+ // Check that the copy constructor for X is called with result variable as
+ // sret argument.
+ // CHECK-CXX98: call void @_ZN1XC1ERKS_(
+ // CHECK-CXX11: call void @_ZN1XC1EOS_(
+ // CHECK-CXX98-ELIDE-NOT: call void @_ZN1XC1ERKS_(
+ // CHECK-CXX11-ELIDE-NOT: call void @_ZN1XC1EOS_(
+
+ // Make sure that the destructor for X is called.
+ // FIXME: This call is present even in the -ELIDE runs, but is guarded by a
+ // branch that is never taken in those cases. We could generate better IR
+ // here.
+ // CHECK: call void @_ZN1XD1Ev(
+ return x;
+}
diff --git a/test/CodeGenCXX/noinline-template.cpp b/test/CodeGenCXX/noinline-template.cpp
index 51a84f7..3dd4366 100644
--- a/test/CodeGenCXX/noinline-template.cpp
+++ b/test/CodeGenCXX/noinline-template.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// This was a problem in Sema, but only shows up as noinline missing
// in CodeGen.
-// CHECK: define linkonce_odr void @_ZN6VectorIiE13growStorageByEv(%struct.Vector* %this) [[NI:#[0-9]+]]
+// CHECK: define linkonce_odr {{.*}}void @_ZN6VectorIiE13growStorageByEv(%struct.Vector* %this) [[NI:#[0-9]+]]
template <class Ty> struct Vector {
void growStorageBy();
diff --git a/test/CodeGenCXX/poly-unsigned.cpp b/test/CodeGenCXX/poly-unsigned.cpp
new file mode 100644
index 0000000..9851a06
--- /dev/null
+++ b/test/CodeGenCXX/poly-unsigned.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -ffreestanding -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-UNSIGNED-POLY %s
+// RUN: %clang_cc1 -triple arm64-linux-gnu -ffreestanding -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-UNSIGNED-POLY %s
+// RUN: %clang_cc1 -triple armv7-apple-ios -ffreestanding -target-cpu cortex-a8 -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-SIGNED-POLY %s
+
+#include <arm_neon.h>
+
+// Polynomial types really should be universally unsigned, otherwise casting
+// (say) poly8_t "x^7" to poly16_t would change it to "x^15 + x^14 + ... +
+// x^7". Unfortunately 32-bit ARM ended up in a slightly delicate ABI situation
+// so for now it got that wrong.
+
+poly16_t test_poly8(poly8_t pIn) {
+// CHECK-UNSIGNED-POLY: @_Z10test_poly8h
+// CHECK-UNSIGNED-POLY: zext i8 {{.*}} to i16
+
+// CHECK-SIGNED-POLY: @_Z10test_poly8a
+// CHECK-SIGNED-POLY: sext i8 {{.*}} to i16
+
+ return pIn;
+}
diff --git a/test/CodeGenCXX/pr11797.cpp b/test/CodeGenCXX/pr11797.cpp
index 1098372..2a31090 100644
--- a/test/CodeGenCXX/pr11797.cpp
+++ b/test/CodeGenCXX/pr11797.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fvisibility hidden -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fvisibility hidden -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
namespace std __attribute__ ((__visibility__ ("default"))) {}
#pragma GCC visibility push(default)
diff --git a/test/CodeGenCXX/pr12104.cpp b/test/CodeGenCXX/pr12104.cpp
index a62f04b..560ffbe 100644
--- a/test/CodeGenCXX/pr12104.cpp
+++ b/test/CodeGenCXX/pr12104.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -include %S/pr12104.h %s -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 -x c++ -emit-pch -o %t %S/pr12104.h
-// RUN: %clang_cc1 -include-pch %t %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -include %S/pr12104.h %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -emit-pch -o %t %S/pr12104.h
+// RUN: %clang_cc1 -include-pch %t %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
template struct Patch<1>;
diff --git a/test/CodeGenCXX/pr13396.cpp b/test/CodeGenCXX/pr13396.cpp
index 3d582c5..e41dd39 100644
--- a/test/CodeGenCXX/pr13396.cpp
+++ b/test/CodeGenCXX/pr13396.cpp
@@ -7,13 +7,13 @@
};
foo::foo() {
- // CHECK-LABEL: define void @_ZN3fooC1Ev(%struct.foo* inreg %this)
// CHECK-LABEL: define void @_ZN3fooC2Ev(%struct.foo* inreg %this)
+ // CHECK-LABEL: define void @_ZN3fooC1Ev(%struct.foo* inreg %this)
}
foo::~foo() {
- // CHECK-LABEL: define void @_ZN3fooD1Ev(%struct.foo* inreg %this)
// CHECK-LABEL: define void @_ZN3fooD2Ev(%struct.foo* inreg %this)
+ // CHECK-LABEL: define void @_ZN3fooD1Ev(%struct.foo* inreg %this)
}
void dummy() {
diff --git a/test/CodeGenCXX/pr18661.cpp b/test/CodeGenCXX/pr18661.cpp
new file mode 100644
index 0000000..2358678
--- /dev/null
+++ b/test/CodeGenCXX/pr18661.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -fcxx-exceptions -fms-extensions -emit-llvm -o - | FileCheck %s
+
+extern "C" {
+ void f();
+
+ // In MS mode we don't validate the exception specification.
+ void f() throw() {
+ }
+}
+
+// PR18661: Clang would fail to emit function definition with mismatching
+// exception specification, even though it was just treated as a warning.
+
+// CHECK: define void @f()
diff --git a/test/CodeGenCXX/pr18962.cpp b/test/CodeGenCXX/pr18962.cpp
new file mode 100644
index 0000000..ab537b4
--- /dev/null
+++ b/test/CodeGenCXX/pr18962.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple i686-linux-gnu %s -emit-llvm -o - | FileCheck %s
+
+class A {
+ // append has to have the same prototype as fn1 to tickle the bug.
+ void (*append)(A *);
+};
+
+class B {};
+class D;
+
+// C has to be non-C++98 POD with available tail padding, making the LLVM base
+// type differ from the complete LLVM type.
+class C {
+ // This member creates a circular LLVM type reference to %class.D.
+ D *m_group;
+ B changeListeners;
+};
+class D : C {};
+
+void fn1(A *p1) {
+}
+
+void
+fn2(C *) {
+}
+
+// We end up using an opaque type for 'append' to avoid circular references.
+// CHECK: %class.A = type { {}* }
+// CHECK: %class.C = type { %class.D*, %class.B }
+// CHECK: %class.D = type { %class.C.base, [3 x i8] }
+// CHECK: %class.C.base = type <{ %class.D*, %class.B }>
+// CHECK: %class.B = type { i8 }
diff --git a/test/CodeGenCXX/pr9965.cpp b/test/CodeGenCXX/pr9965.cpp
index c2d54e1..46fd609 100644
--- a/test/CodeGenCXX/pr9965.cpp
+++ b/test/CodeGenCXX/pr9965.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
struct A { A(); };
template<typename T>
struct X : A // default constructor is not trivial
diff --git a/test/CodeGenCXX/pragma-pack-3.cpp b/test/CodeGenCXX/pragma-pack-3.cpp
new file mode 100644
index 0000000..49509a5
--- /dev/null
+++ b/test/CodeGenCXX/pragma-pack-3.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+struct Base {
+ char a;
+};
+
+struct Derived_1 : virtual Base
+{
+ char b;
+};
+
+#pragma pack(1)
+struct Derived_2 : Derived_1 {
+ // CHECK: %struct.Derived_2 = type { %struct.Derived_1.base, %struct.Base }
+ // CHECK: %struct.Derived_1.base = type <{ i32 (...)**, i8 }>
+};
+
+Derived_2 x;
diff --git a/test/CodeGenCXX/pragma-weak.cpp b/test/CodeGenCXX/pragma-weak.cpp
index c033079..e2d4648 100644
--- a/test/CodeGenCXX/pragma-weak.cpp
+++ b/test/CodeGenCXX/pragma-weak.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
#pragma weak zex
int zex;
@@ -10,7 +10,7 @@
#pragma weak foo
struct S { void foo(); };
void S::foo() {}
-// CHECK-LABEL: define void @_ZN1S3fooEv(
+// CHECK-LABEL: define {{.*}}void @_ZN1S3fooEv(
#pragma weak zed
namespace bar { void zed() {} }
diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp
index 9062ee0..f901467 100644
--- a/test/CodeGenCXX/predefined-expr.cpp
+++ b/test/CodeGenCXX/predefined-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
// CHECK: private unnamed_addr constant [15 x i8] c"externFunction\00"
// CHECK: private unnamed_addr constant [26 x i8] c"void NS::externFunction()\00"
@@ -10,7 +10,7 @@
// CHECK: private unnamed_addr constant [122 x i8] c"static void ClassWithTemplateTemplateParam<char, NS::ClassTemplate>::staticMember() [T = char, Param = NS::ClassTemplate]\00"
// CHECK: private unnamed_addr constant [106 x i8] c"void OuterClass<int *>::MiddleClass::InnerClass<float>::memberFunction(T, U) const [T = int *, U = float]\00"
// CHECK: private unnamed_addr constant [51 x i8] c"void functionTemplateWithCapturedStmt(T) [T = int]\00"
-// CHECK: private unnamed_addr constant [76 x i8] c"auto functionTemplateWithLambda(int)::<anonymous class>::operator()() const\00"
+// CHECK: private unnamed_addr constant [76 x i8] c"auto functionTemplateWithLambda(int)::(anonymous class)::operator()() const\00"
// CHECK: private unnamed_addr constant [65 x i8] c"void functionTemplateWithUnnamedTemplateParameter(T) [T = float]\00"
// CHECK: private unnamed_addr constant [60 x i8] c"void functionTemplateExplicitSpecialization(T) [T = double]\00"
@@ -28,13 +28,13 @@
// CHECK: private unnamed_addr constant [46 x i8] c"void NS::Base::functionTemplate1(T) [T = int]\00"
// CHECK: private unnamed_addr constant [23 x i8] c"anonymousUnionFunction\00"
-// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous union)::anonymousUnionFunction()\00"
// CHECK: private unnamed_addr constant [24 x i8] c"anonymousStructFunction\00"
-// CHECK: private unnamed_addr constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00"
+// CHECK: private unnamed_addr constant [85 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous struct)::anonymousStructFunction()\00"
// CHECK: private unnamed_addr constant [23 x i8] c"anonymousClassFunction\00"
-// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous class)::anonymousClassFunction()\00"
// CHECK: private unnamed_addr constant [12 x i8] c"~Destructor\00"
// CHECK: private unnamed_addr constant [30 x i8] c"NS::Destructor::~Destructor()\00"
@@ -93,7 +93,7 @@
// CHECK: private unnamed_addr constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00"
// CHECK: private unnamed_addr constant [27 x i8] c"anonymousNamespaceFunction\00"
-// CHECK: private unnamed_addr constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
+// CHECK: private unnamed_addr constant [84 x i8] c"void (anonymous namespace)::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
// CHECK: private unnamed_addr constant [19 x i8] c"localClassFunction\00"
// CHECK: private unnamed_addr constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00"
diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp
index 914a90a..e02b209 100644
--- a/test/CodeGenCXX/ptr-to-member-function.cpp
+++ b/test/CodeGenCXX/ptr-to-member-function.cpp
@@ -1,8 +1,7 @@
-// REQUIRES: x86-registered-target,x86-64-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck -check-prefix CHECK-LP64 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
+// RUN: FileCheck -check-prefix CHECK-LP32 %s
// 13.3.3.2 Ranking implicit conversion sequences
extern "C" int printf(...);
@@ -64,8 +63,8 @@
B1 c = B1(2);
}
-// CHECK-LP64: callq __ZN1XcvM1BFvvEEv
-// CHECK-LP64: callq __Z1gM1CFvvE
+// CHECK-LP64: call { i64, i64 } @_ZN1XcvM1BFvvEEv
+// CHECK-LP64: call void @_Z1gM1CFvvE
-// CHECK-LP32: calll L__ZN1XcvM1BFvvEEv
-// CHECK-LP32: calll __Z1gM1CFvvE
+// CHECK-LP32: call i64 @_ZN1XcvM1BFvvEEv
+// CHECK-LP32: call void @_Z1gM1CFvvE
diff --git a/test/CodeGenCXX/reference-field.cpp b/test/CodeGenCXX/reference-field.cpp
index 0312029..54e914d 100644
--- a/test/CodeGenCXX/reference-field.cpp
+++ b/test/CodeGenCXX/reference-field.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s -O2 | grep "@_Z1bv"
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s -O2 | FileCheck %s
// Make sure the call to b() doesn't get optimized out.
extern struct x {char& x,y;}y;
int b();
int a() { if (!&y.x) b(); }
+
+// CHECK: @_Z1bv
diff --git a/test/CodeGenCXX/reference-init.cpp b/test/CodeGenCXX/reference-init.cpp
index d47b1f3..3a3eaee 100644
--- a/test/CodeGenCXX/reference-init.cpp
+++ b/test/CodeGenCXX/reference-init.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -verify %s
// expected-no-diagnostics
struct XPTParamDescriptor {};
diff --git a/test/CodeGenCXX/return.cpp b/test/CodeGenCXX/return.cpp
index 1975055..5c1cfda 100644
--- a/test/CodeGenCXX/return.cpp
+++ b/test/CodeGenCXX/return.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -O -o - %s | FileCheck %s --check-prefix=CHECK-OPT
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -O -o - %s | FileCheck %s --check-prefix=CHECK-OPT
// CHECK: @_Z9no_return
// CHECK-OPT: @_Z9no_return
diff --git a/test/CodeGenCXX/rtti-fundamental.cpp b/test/CodeGenCXX/rtti-fundamental.cpp
index 2495e96..14297b6 100644
--- a/test/CodeGenCXX/rtti-fundamental.cpp
+++ b/test/CodeGenCXX/rtti-fundamental.cpp
@@ -15,102 +15,102 @@
}
// void
-// CHECK: @_ZTIv = unnamed_addr constant
-// CHECK: @_ZTIPv = unnamed_addr constant
-// CHECK: @_ZTIPKv = unnamed_addr constant
+// CHECK: @_ZTIv = constant
+// CHECK: @_ZTIPv = constant
+// CHECK: @_ZTIPKv = constant
// std::nullptr_t
-// CHECK: @_ZTIDn = unnamed_addr constant
-// CHECK: @_ZTIPDn = unnamed_addr constant
-// CHECK: @_ZTIPKDn = unnamed_addr constant
+// CHECK: @_ZTIDn = constant
+// CHECK: @_ZTIPDn = constant
+// CHECK: @_ZTIPKDn = constant
// bool
-// CHECK: @_ZTIb = unnamed_addr constant
-// CHECK: @_ZTIPb = unnamed_addr constant
-// CHECK: @_ZTIPKb = unnamed_addr constant
+// CHECK: @_ZTIb = constant
+// CHECK: @_ZTIPb = constant
+// CHECK: @_ZTIPKb = constant
// wchar_t
-// CHECK: @_ZTIw = unnamed_addr constant
-// CHECK: @_ZTIPw = unnamed_addr constant
-// CHECK: @_ZTIPKw = unnamed_addr constant
+// CHECK: @_ZTIw = constant
+// CHECK: @_ZTIPw = constant
+// CHECK: @_ZTIPKw = constant
// char
-// CHECK: @_ZTIc = unnamed_addr constant
-// CHECK: @_ZTIPc = unnamed_addr constant
-// CHECK: @_ZTIPKc = unnamed_addr constant
+// CHECK: @_ZTIc = constant
+// CHECK: @_ZTIPc = constant
+// CHECK: @_ZTIPKc = constant
// unsigned char
-// CHECK: @_ZTIh = unnamed_addr constant
-// CHECK: @_ZTIPh = unnamed_addr constant
-// CHECK: @_ZTIPKh = unnamed_addr constant
+// CHECK: @_ZTIh = constant
+// CHECK: @_ZTIPh = constant
+// CHECK: @_ZTIPKh = constant
// signed char
-// CHECK: @_ZTIa = unnamed_addr constant
-// CHECK: @_ZTIPa = unnamed_addr constant
-// CHECK: @_ZTIPKa = unnamed_addr constant
+// CHECK: @_ZTIa = constant
+// CHECK: @_ZTIPa = constant
+// CHECK: @_ZTIPKa = constant
// short
-// CHECK: @_ZTIs = unnamed_addr constant
-// CHECK: @_ZTIPs = unnamed_addr constant
-// CHECK: @_ZTIPKs = unnamed_addr constant
+// CHECK: @_ZTIs = constant
+// CHECK: @_ZTIPs = constant
+// CHECK: @_ZTIPKs = constant
// unsigned short
-// CHECK: @_ZTIt = unnamed_addr constant
-// CHECK: @_ZTIPt = unnamed_addr constant
-// CHECK: @_ZTIPKt = unnamed_addr constant
+// CHECK: @_ZTIt = constant
+// CHECK: @_ZTIPt = constant
+// CHECK: @_ZTIPKt = constant
// int
-// CHECK: @_ZTIi = unnamed_addr constant
-// CHECK: @_ZTIPi = unnamed_addr constant
-// CHECK: @_ZTIPKi = unnamed_addr constant
+// CHECK: @_ZTIi = constant
+// CHECK: @_ZTIPi = constant
+// CHECK: @_ZTIPKi = constant
// unsigned int
-// CHECK: @_ZTIj = unnamed_addr constant
-// CHECK: @_ZTIPj = unnamed_addr constant
-// CHECK: @_ZTIPKj = unnamed_addr constant
+// CHECK: @_ZTIj = constant
+// CHECK: @_ZTIPj = constant
+// CHECK: @_ZTIPKj = constant
// long
-// CHECK: @_ZTIl = unnamed_addr constant
-// CHECK: @_ZTIPl = unnamed_addr constant
-// CHECK: @_ZTIPKl = unnamed_addr constant
+// CHECK: @_ZTIl = constant
+// CHECK: @_ZTIPl = constant
+// CHECK: @_ZTIPKl = constant
// unsigned long
-// CHECK: @_ZTIm = unnamed_addr constant
-// CHECK: @_ZTIPm = unnamed_addr constant
-// CHECK: @_ZTIPKm = unnamed_addr constant
+// CHECK: @_ZTIm = constant
+// CHECK: @_ZTIPm = constant
+// CHECK: @_ZTIPKm = constant
// long long
-// CHECK: @_ZTIx = unnamed_addr constant
-// CHECK: @_ZTIPx = unnamed_addr constant
-// CHECK: @_ZTIPKx = unnamed_addr constant
+// CHECK: @_ZTIx = constant
+// CHECK: @_ZTIPx = constant
+// CHECK: @_ZTIPKx = constant
// unsigned long long
-// CHECK: @_ZTIy = unnamed_addr constant
-// CHECK: @_ZTIPy = unnamed_addr constant
-// CHECK: @_ZTIPKy = unnamed_addr constant
+// CHECK: @_ZTIy = constant
+// CHECK: @_ZTIPy = constant
+// CHECK: @_ZTIPKy = constant
// float
-// CHECK: @_ZTIf = unnamed_addr constant
-// CHECK: @_ZTIPf = unnamed_addr constant
-// CHECK: @_ZTIPKf = unnamed_addr constant
+// CHECK: @_ZTIf = constant
+// CHECK: @_ZTIPf = constant
+// CHECK: @_ZTIPKf = constant
// double
-// CHECK: @_ZTId = unnamed_addr constant
-// CHECK: @_ZTIPd = unnamed_addr constant
-// CHECK: @_ZTIPKd = unnamed_addr constant
+// CHECK: @_ZTId = constant
+// CHECK: @_ZTIPd = constant
+// CHECK: @_ZTIPKd = constant
// long double
-// CHECK: @_ZTIe = unnamed_addr constant
-// CHECK: @_ZTIPe = unnamed_addr constant
-// CHECK: @_ZTIPKe = unnamed_addr constant
+// CHECK: @_ZTIe = constant
+// CHECK: @_ZTIPe = constant
+// CHECK: @_ZTIPKe = constant
// char16_t
-// CHECK: @_ZTIDs = unnamed_addr constant
-// CHECK: @_ZTIPDs = unnamed_addr constant
-// CHECK: @_ZTIPKDs = unnamed_addr constant
+// CHECK: @_ZTIDs = constant
+// CHECK: @_ZTIPDs = constant
+// CHECK: @_ZTIPKDs = constant
// char32_t
-// CHECK: @_ZTIDi = unnamed_addr constant
-// CHECK: @_ZTIPDi = unnamed_addr constant
-// CHECK: @_ZTIPKDi = unnamed_addr constant
+// CHECK: @_ZTIDi = constant
+// CHECK: @_ZTIPDi = constant
+// CHECK: @_ZTIPKDi = constant
diff --git a/test/CodeGenCXX/rtti-linkage.cpp b/test/CodeGenCXX/rtti-linkage.cpp
index 42fe435..1484b99 100644
--- a/test/CodeGenCXX/rtti-linkage.cpp
+++ b/test/CodeGenCXX/rtti-linkage.cpp
@@ -1,56 +1,72 @@
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fvisibility hidden -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH-HIDDEN %s
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fvisibility hidden -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH-HIDDEN %s
#include <typeinfo>
// CHECK-WITH-HIDDEN: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
// CHECK-WITH-HIDDEN: @_ZTSPK2T4 = linkonce_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTS2T4 = linkonce_odr hidden constant
-// CHECK-WITH-HIDDEN: @_ZTI2T4 = linkonce_odr hidden unnamed_addr constant
-// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = linkonce_odr hidden unnamed_addr constant
+// CHECK-WITH-HIDDEN: @_ZTI2T4 = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTSZ2t5vE1A = internal constant
+// CHECK-WITH-HIDDEN: @_ZTIZ2t5vE1A = internal constant
+// CHECK-WITH-HIDDEN: @_ZTSPZ2t7vE1A = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTSZ2t7vE1A = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTIZ2t7vE1A = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTIPZ2t7vE1A = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTSZ2t6vE1A = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTIZ2t6vE1A = linkonce_odr hidden constant
// CHECK: _ZTSP1C = internal constant
// CHECK: _ZTS1C = internal constant
-// CHECK: _ZTI1C = internal unnamed_addr constant
-// CHECK: _ZTIP1C = internal unnamed_addr constant
+// CHECK: _ZTI1C = internal constant
+// CHECK: _ZTIP1C = internal constant
// CHECK: _ZTSPP1C = internal constant
-// CHECK: _ZTIPP1C = internal unnamed_addr constant
+// CHECK: _ZTIPP1C = internal constant
// CHECK: _ZTSM1Ci = internal constant
-// CHECK: _ZTIM1Ci = internal unnamed_addr constant
+// CHECK: _ZTIM1Ci = internal constant
// CHECK: _ZTSPM1Ci = internal constant
-// CHECK: _ZTIPM1Ci = internal unnamed_addr constant
+// CHECK: _ZTIPM1Ci = internal constant
// CHECK: _ZTSM1CS_ = internal constant
-// CHECK: _ZTIM1CS_ = internal unnamed_addr constant
+// CHECK: _ZTIM1CS_ = internal constant
// CHECK: _ZTSM1CPS_ = internal constant
-// CHECK: _ZTIM1CPS_ = internal unnamed_addr constant
+// CHECK: _ZTIM1CPS_ = internal constant
// CHECK: _ZTSM1A1C = internal constant
// CHECK: _ZTS1A = linkonce_odr constant
-// CHECK: _ZTI1A = linkonce_odr hidden unnamed_addr constant
-// CHECK: _ZTIM1A1C = internal unnamed_addr constant
+// CHECK: _ZTI1A = linkonce_odr constant
+// CHECK: _ZTIM1A1C = internal constant
// CHECK: _ZTSM1AP1C = internal constant
-// CHECK: _ZTIM1AP1C = internal unnamed_addr constant
+// CHECK: _ZTIM1AP1C = internal constant
// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTIN12_GLOBAL__N_11DE = internal unnamed_addr constant
+// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal unnamed_addr constant
+// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
-// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal unnamed_addr constant
+// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
-// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal unnamed_addr constant
+// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
// CHECK: _ZTSPFvvE = linkonce_odr constant
// CHECK: _ZTSFvvE = linkonce_odr constant
-// CHECK: _ZTIFvvE = linkonce_odr hidden unnamed_addr constant
-// CHECK: _ZTIPFvvE = linkonce_odr hidden unnamed_addr constant
+// CHECK: _ZTIFvvE = linkonce_odr constant
+// CHECK: _ZTIPFvvE = linkonce_odr constant
// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
-// CHECK: _ZTIN12_GLOBAL__N_11EE = internal unnamed_addr constant
+// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
// CHECK: _ZTSA10_i = linkonce_odr constant
-// CHECK: _ZTIA10_i = linkonce_odr hidden unnamed_addr constant
-// CHECK: _ZTI1TILj0EE = linkonce_odr unnamed_addr constant
-// CHECK: _ZTI1TILj1EE = weak_odr unnamed_addr constant
+// CHECK: _ZTIA10_i = linkonce_odr constant
+// CHECK: _ZTI1TILj0EE = linkonce_odr constant
+// CHECK: _ZTI1TILj1EE = weak_odr constant
// CHECK: _ZTI1TILj2EE = external constant
+// CHECK: _ZTSZ2t5vE1A = internal constant
+// CHECK: _ZTIZ2t5vE1A = internal constant
// CHECK: _ZTS1B = constant
-// CHECK: _ZTI1B = unnamed_addr constant
+// CHECK: _ZTI1B = constant
// CHECK: _ZTS1F = linkonce_odr constant
+// CHECK: _ZTSPZ2t7vE1A = linkonce_odr constant
+// CHECK: _ZTSZ2t7vE1A = linkonce_odr constant
+// CHECK: _ZTIZ2t7vE1A = linkonce_odr constant
+// CHECK: _ZTIPZ2t7vE1A = linkonce_odr constant
+// CHECK: _ZTSZ2t6vE1A = linkonce_odr constant
+// CHECK: _ZTIZ2t6vE1A = linkonce_odr constant
// CHECK: _ZTIN12_GLOBAL__N_11DE to
@@ -138,3 +154,25 @@
void t4(const T4 *ptr) {
const void *value = &typeid(ptr);
}
+
+// rdar://16265084
+void t5() {
+ struct A {};
+ const void *value = &typeid(A);
+}
+
+inline void t6() {
+ struct A {};
+ const void *value = &typeid(A);
+}
+void t6_helper() {
+ t6();
+}
+
+inline void t7() {
+ struct A {};
+ const void *value = &typeid(A*);
+}
+void t7_helper() {
+ t7();
+}
diff --git a/test/CodeGenCXX/rtti-visibility.cpp b/test/CodeGenCXX/rtti-visibility.cpp
index 40cee06..5945be5 100644
--- a/test/CodeGenCXX/rtti-visibility.cpp
+++ b/test/CodeGenCXX/rtti-visibility.cpp
@@ -1,17 +1,15 @@
// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o %t.hidden
// RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t
-// RUN: FileCheck --check-prefix=CHECK-TEST2-HIDDEN %s < %t.hidden
#include <typeinfo>
namespace Test1 {
// A is explicitly marked hidden, so all RTTI data should also be marked hidden.
// CHECK-TEST1: @_ZTSN5Test11AE = linkonce_odr hidden constant
- // CHECK-TEST1: @_ZTIN5Test11AE = linkonce_odr hidden unnamed_addr constant
+ // CHECK-TEST1: @_ZTIN5Test11AE = linkonce_odr hidden constant
// CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant
- // CHECK-TEST1: @_ZTIPN5Test11AE = linkonce_odr hidden unnamed_addr constant
+ // CHECK-TEST1: @_ZTIPN5Test11AE = linkonce_odr hidden constant
struct __attribute__((visibility("hidden"))) A { };
void f() {
@@ -23,12 +21,8 @@
namespace Test2 {
// A is weak, so its linkage should be linkoce_odr, but not marked hidden.
// CHECK-TEST2: @_ZTSN5Test21AE = linkonce_odr constant
- // CHECK-TEST2: @_ZTIN5Test21AE = linkonce_odr unnamed_addr constant
+ // CHECK-TEST2: @_ZTIN5Test21AE = linkonce_odr constant
struct A { };
-
- // With -fhidden-weak-vtables, the typeinfo for A is marked hidden, but not its name.
- // CHECK-TEST2-HIDDEN: _ZTSN5Test21AE = linkonce_odr constant
- // CHECK-TEST2-HIDDEN: @_ZTIN5Test21AE = linkonce_odr hidden unnamed_addr constant
void f() {
(void)typeid(A);
}
diff --git a/test/CodeGenCXX/scoped-enums.cpp b/test/CodeGenCXX/scoped-enums.cpp
index 159172d..218013a 100644
--- a/test/CodeGenCXX/scoped-enums.cpp
+++ b/test/CodeGenCXX/scoped-enums.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
// PR9923
enum class Color { red, blue, green };
diff --git a/test/CodeGenCXX/sparcv9-abi.cpp b/test/CodeGenCXX/sparcv9-abi.cpp
new file mode 100644
index 0000000..128d648
--- /dev/null
+++ b/test/CodeGenCXX/sparcv9-abi.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple sparcv9-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+struct pod {
+ int a, b;
+};
+
+void f0();
+void f1(struct pod);
+
+struct notpod {
+ int a, b;
+ ~notpod() { f0(); }
+};
+
+void f2(struct notpod);
+
+// CHECK-LABEL: caller
+// CHECK: call void @_Z2f13pod(i64
+// CHECK: call void @_Z2f26notpod(%struct.notpod*
+void caller()
+{
+ pod p1;
+ notpod p2;
+ f1(p1);
+ f2(p2);
+}
diff --git a/test/CodeGenCXX/specialized-static-data-mem-init.cpp b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
index c2a2ddb..21bc123 100644
--- a/test/CodeGenCXX/specialized-static-data-mem-init.cpp
+++ b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// rdar: // 8562966
// pr8409
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index f522775..d23ead4 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -103,14 +103,14 @@
B::B() {
static int x = foo();
}
- // CHECK-LABEL: define void @_ZN5test21BC1Ev
+ // CHECK-LABEL: define void @_ZN5test21BC2Ev
// CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
// CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
// CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
// CHECK: store i32 [[T0]], i32* @_ZZN5test21BC1EvE1x,
// CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BC1EvE1x)
- // CHECK-LABEL: define void @_ZN5test21BC2Ev
+ // CHECK-LABEL: define void @_ZN5test21BC1Ev
// CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
// CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
// CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
@@ -122,15 +122,15 @@
B::~B() {
static int y = foo();
}
- // CHECK-LABEL: define void @_ZN5test21BD1Ev(
- // CHECK: call void @_ZN5test21BD2Ev(
-
// CHECK-LABEL: define void @_ZN5test21BD2Ev(
// CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BD1EvE1y to i8*) acquire,
// CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BD1EvE1y)
// CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
// CHECK: store i32 [[T0]], i32* @_ZZN5test21BD1EvE1y,
// CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BD1EvE1y)
+
+ // CHECK-LABEL: define void @_ZN5test21BD1Ev(
+ // CHECK: call void @_ZN5test21BD2Ev(
}
// This shouldn't error out.
@@ -149,6 +149,6 @@
union U { char x; int i; };
static U u = { 'a' };
}
- // CHECK-LABEL: define void @_ZN5test31BC1Ev(
// CHECK-LABEL: define void @_ZN5test31BC2Ev(
+ // CHECK-LABEL: define void @_ZN5test31BC1Ev(
}
diff --git a/test/CodeGenCXX/stmtexpr.cpp b/test/CodeGenCXX/stmtexpr.cpp
index 5d4d6bc..7bf19bb 100644
--- a/test/CodeGenCXX/stmtexpr.cpp
+++ b/test/CodeGenCXX/stmtexpr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-unused-value -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
// rdar: //8540501
extern "C" int printf(...);
extern "C" void abort();
diff --git a/test/CodeGenCXX/template-dependent-bind-temporary.cpp b/test/CodeGenCXX/template-dependent-bind-temporary.cpp
index ca980c3..47d8279 100644
--- a/test/CodeGenCXX/template-dependent-bind-temporary.cpp
+++ b/test/CodeGenCXX/template-dependent-bind-temporary.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// rdar: //8620524
// PR7851
struct string {
diff --git a/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
index de86f10..137792b 100644
--- a/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
+++ b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -fvisibility hidden -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fvisibility hidden -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
// Verify that symbols are hidden.
// CHECK: @_ZN1CIiE5Inner6Inner26StaticE = weak_odr hidden global
-// CHECK-LABEL: define weak_odr hidden void @_ZN1CIiE5Inner1fEv
-// CHECK-LABEL: define weak_odr hidden void @_ZN1CIiE5Inner6Inner21gEv
+// CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1CIiE5Inner1fEv
+// CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1CIiE5Inner6Inner21gEv
template<typename T>
struct C {
diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp
index 80283a1..3baa946 100644
--- a/test/CodeGenCXX/template-instantiation.cpp
+++ b/test/CodeGenCXX/template-instantiation.cpp
@@ -5,11 +5,15 @@
//
// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
// CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE
-// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = unnamed_addr constant
+// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA1_iEE
+// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE
+// CHECK: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant
// CHECK: @_ZN7PR100011SIiE3arrE = weak_odr global [3 x i32]
// CHECK-NOT: @_ZN7PR100011SIiE3arr2E = weak_odr global [3 x i32]A
+// CHECK: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant
+
// CHECK-NOT: _ZTVN5test31SIiEE
// CHECK-NOT: _ZTSN5test31SIiEE
@@ -39,11 +43,21 @@
virtual void xsgetn();
};
- // This specialization should cause the vtable to be emitted, even with
- // the following extern template declaration.
- template<> void stdio_sync_filebuf<wchar_t>::xsgetn() {
+ // This specialization is not a key function, so doesn't cause the vtable to
+ // be instantiated unless we're instantiating a class definition anyway.
+ template<> void stdio_sync_filebuf<int[1]>::xsgetn() {
}
- extern template class stdio_sync_filebuf<wchar_t>;
+ template<> void stdio_sync_filebuf<int[2]>::xsgetn() {
+ }
+ template<> void stdio_sync_filebuf<int[3]>::xsgetn() {
+ }
+ template<> void stdio_sync_filebuf<int[4]>::xsgetn() {
+ }
+ extern template class stdio_sync_filebuf<int[2]>;
+
+ // These two both cause vtables to be emitted.
+ template class stdio_sync_filebuf<int[3]>;
+ stdio_sync_filebuf<int[4]> implicit_instantiation;
}
namespace test1 {
diff --git a/test/CodeGenCXX/throw-expression-dtor.cpp b/test/CodeGenCXX/throw-expression-dtor.cpp
index cb4a6c6..b883b85 100644
--- a/test/CodeGenCXX/throw-expression-dtor.cpp
+++ b/test/CodeGenCXX/throw-expression-dtor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm-only -verify -fcxx-exceptions -fexceptions
+// RUN: %clang_cc1 %s -emit-llvm-only -verify -triple %itanium_abi_triple -fcxx-exceptions -fexceptions
// expected-no-diagnostics
// PR7281
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp
index d9bf8fd..7e81141 100644
--- a/test/CodeGenCXX/throw-expressions.cpp
+++ b/test/CodeGenCXX/throw-expressions.cpp
@@ -67,3 +67,16 @@
//
// end:
// CHECK: ret i32
+
+namespace DR1560 {
+ struct A {
+ ~A();
+ };
+ extern bool b;
+ A get();
+ // CHECK-LABEL: @_ZN6DR15601bE
+ const A &r = b ? get() : throw 0;
+ // CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev
+ // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN6DR15601AD1Ev {{.*}} @_ZGRN6DR15601rE
+ // CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev
+}
diff --git a/test/CodeGenCXX/thunk-use-after-free.cpp b/test/CodeGenCXX/thunk-use-after-free.cpp
index d70e902..14f2356 100644
--- a/test/CodeGenCXX/thunk-use-after-free.cpp
+++ b/test/CodeGenCXX/thunk-use-after-free.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -O1 %s
+// RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -O1 %s
// This used to crash under asan and valgrind.
// PR12284
diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp
index defb706..89e4db3 100644
--- a/test/CodeGenCXX/thunks.cpp
+++ b/test/CodeGenCXX/thunks.cpp
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - -O1 -disable-llvm-optzns | FileCheck %s
-// RUN: %clang_cc1 %s -triple=x86_64-pc-linux-gnu -munwind-tables -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=CHECK-HIDDEN %s
namespace Test1 {
@@ -251,9 +250,7 @@
struct B { virtual void foo(); };
struct C : A, B { void foo() {} };
- // CHECK-HIDDEN-LABEL: define linkonce_odr void @_ZN6Test101C3fooEv
- // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZThn8_N6Test101C3fooEv
-
+ // Test later.
void test() {
C c;
}
@@ -366,6 +363,10 @@
/**** The following has to go at the end of the file ****/
+// This is from Test10:
+// CHECK-LABEL: define linkonce_odr void @_ZN6Test101C3fooEv
+// CHECK-LABEL: define linkonce_odr void @_ZThn8_N6Test101C3fooEv
+
// This is from Test5:
// CHECK-LABEL: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
// CHECK-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(
diff --git a/test/CodeGenCXX/trivial-constructor-init.cpp b/test/CodeGenCXX/trivial-constructor-init.cpp
index 65ed45e..9130e4e 100644
--- a/test/CodeGenCXX/trivial-constructor-init.cpp
+++ b/test/CodeGenCXX/trivial-constructor-init.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -std=c++11 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -std=c++11 -triple %itanium_abi_triple | FileCheck %s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/unary-type-trait.cpp b/test/CodeGenCXX/type-traits.cpp
similarity index 62%
rename from test/CodeGenCXX/unary-type-trait.cpp
rename to test/CodeGenCXX/type-traits.cpp
index 3c6f9c0..93cc6b5 100644
--- a/test/CodeGenCXX/unary-type-trait.cpp
+++ b/test/CodeGenCXX/type-traits.cpp
@@ -2,3 +2,5 @@
// expected-no-diagnostics
bool a() { return __is_pod(int); }
+
+bool b() { return __is_trivially_constructible(int, int, int); }
diff --git a/test/CodeGenCXX/type_visibility.cpp b/test/CodeGenCXX/type_visibility.cpp
index 11e5091..a7b7198 100644
--- a/test/CodeGenCXX/type_visibility.cpp
+++ b/test/CodeGenCXX/type_visibility.cpp
@@ -29,11 +29,11 @@
// FUNS-LABEL: define weak_odr void @_ZN5temp01BINS_1AEE3fooEv(
// VARS: @_ZTVN5temp01BINS_1AEEE = weak_odr unnamed_addr constant
// VARS: @_ZTSN5temp01BINS_1AEEE = weak_odr constant
- // VARS: @_ZTIN5temp01BINS_1AEEE = weak_odr unnamed_addr constant
+ // VARS: @_ZTIN5temp01BINS_1AEEE = weak_odr constant
// FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp01BINS_1AEE3fooEv(
// VARS-HIDDEN: @_ZTVN5temp01BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5temp01BINS_1AEEE = weak_odr hidden constant
- // VARS-HIDDEN: @_ZTIN5temp01BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5temp01BINS_1AEEE = weak_odr hidden constant
}
namespace temp1 {
@@ -46,11 +46,11 @@
// FUNS-LABEL: define weak_odr void @_ZN5temp11BINS_1AEE3fooEv(
// VARS: @_ZTVN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
// VARS: @_ZTSN5temp11BINS_1AEEE = weak_odr constant
- // VARS: @_ZTIN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
+ // VARS: @_ZTIN5temp11BINS_1AEEE = weak_odr constant
// FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp11BINS_1AEE3fooEv(
// VARS-HIDDEN: @_ZTVN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5temp11BINS_1AEEE = weak_odr constant
- // VARS-HIDDEN: @_ZTIN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5temp11BINS_1AEEE = weak_odr constant
}
namespace temp2 {
@@ -63,11 +63,11 @@
// FUNS-LABEL: define weak_odr void @_ZN5temp21BINS_1AEE3fooEv(
// VARS: @_ZTVN5temp21BINS_1AEEE = weak_odr unnamed_addr constant
// VARS: @_ZTSN5temp21BINS_1AEEE = weak_odr constant
- // VARS: @_ZTIN5temp21BINS_1AEEE = weak_odr unnamed_addr constant
+ // VARS: @_ZTIN5temp21BINS_1AEEE = weak_odr constant
// FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp21BINS_1AEE3fooEv(
// VARS-HIDDEN: @_ZTVN5temp21BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5temp21BINS_1AEEE = weak_odr hidden constant
- // VARS-HIDDEN: @_ZTIN5temp21BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5temp21BINS_1AEEE = weak_odr hidden constant
}
namespace temp3 {
@@ -80,11 +80,11 @@
// FUNS-LABEL: define weak_odr hidden void @_ZN5temp31BINS_1AEE3fooEv(
// VARS: @_ZTVN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS: @_ZTSN5temp31BINS_1AEEE = weak_odr hidden constant
- // VARS: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden constant
// FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp31BINS_1AEE3fooEv(
// VARS-HIDDEN: @_ZTVN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5temp31BINS_1AEEE = weak_odr hidden constant
- // VARS-HIDDEN: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden constant
}
namespace temp4 {
@@ -97,11 +97,11 @@
// FUNS-LABEL: define weak_odr void @_ZN5temp41BINS_1AEE3fooEv(
// VARS: @_ZTVN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS: @_ZTSN5temp41BINS_1AEEE = weak_odr hidden constant
- // VARS: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden constant
// FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp41BINS_1AEE3fooEv(
// VARS-HIDDEN: @_ZTVN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5temp41BINS_1AEEE = weak_odr hidden constant
- // VARS-HIDDEN: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden constant
}
namespace type0 {
@@ -113,11 +113,11 @@
// FUNS-LABEL: define void @_ZN5type01A3fooEv(
// VARS: @_ZTVN5type01AE = unnamed_addr constant
// VARS: @_ZTSN5type01AE = constant
- // VARS: @_ZTIN5type01AE = unnamed_addr constant
+ // VARS: @_ZTIN5type01AE = constant
// FUNS-HIDDEN-LABEL: define hidden void @_ZN5type01A3fooEv(
// VARS-HIDDEN: @_ZTVN5type01AE = unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5type01AE = constant
- // VARS-HIDDEN: @_ZTIN5type01AE = unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5type01AE = constant
}
namespace type1 {
@@ -129,11 +129,11 @@
// FUNS-LABEL: define hidden void @_ZN5type11A3fooEv(
// VARS: @_ZTVN5type11AE = unnamed_addr constant
// VARS: @_ZTSN5type11AE = constant
- // VARS: @_ZTIN5type11AE = unnamed_addr constant
+ // VARS: @_ZTIN5type11AE = constant
// FUNS-HIDDEN-LABEL: define hidden void @_ZN5type11A3fooEv(
// VARS-HIDDEN: @_ZTVN5type11AE = unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5type11AE = constant
- // VARS-HIDDEN: @_ZTIN5type11AE = unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5type11AE = constant
}
namespace type2 {
@@ -145,11 +145,11 @@
// FUNS-LABEL: define void @_ZN5type21A3fooEv(
// VARS: @_ZTVN5type21AE = hidden unnamed_addr constant
// VARS: @_ZTSN5type21AE = hidden constant
- // VARS: @_ZTIN5type21AE = hidden unnamed_addr constant
+ // VARS: @_ZTIN5type21AE = hidden constant
// FUNS-HIDDEN-LABEL: define hidden void @_ZN5type21A3fooEv(
// VARS-HIDDEN: @_ZTVN5type21AE = hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5type21AE = hidden constant
- // VARS-HIDDEN: @_ZTIN5type21AE = hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5type21AE = hidden constant
}
namespace type3 {
@@ -161,10 +161,10 @@
// FUNS-LABEL: define void @_ZN5type31A3fooEv(
// VARS: @_ZTVN5type31AE = hidden unnamed_addr constant
// VARS: @_ZTSN5type31AE = hidden constant
- // VARS: @_ZTIN5type31AE = hidden unnamed_addr constant
+ // VARS: @_ZTIN5type31AE = hidden constant
// FUNS-HIDDEN-LABEL: define void @_ZN5type31A3fooEv(
// VARS-HIDDEN: @_ZTVN5type31AE = hidden unnamed_addr constant
// VARS-HIDDEN: @_ZTSN5type31AE = hidden constant
- // VARS-HIDDEN: @_ZTIN5type31AE = hidden unnamed_addr constant
+ // VARS-HIDDEN: @_ZTIN5type31AE = hidden constant
}
diff --git a/test/CodeGenCXX/vararg-non-pod.cpp b/test/CodeGenCXX/vararg-non-pod.cpp
index 9497179..613b28c 100644
--- a/test/CodeGenCXX/vararg-non-pod.cpp
+++ b/test/CodeGenCXX/vararg-non-pod.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-error=non-pod-varargs -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
struct X {
X();
diff --git a/test/CodeGenCXX/virt-dtor-gen.cpp b/test/CodeGenCXX/virt-dtor-gen.cpp
index 78a0b81..ba83689 100644
--- a/test/CodeGenCXX/virt-dtor-gen.cpp
+++ b/test/CodeGenCXX/virt-dtor-gen.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck %s
+// RUN: %clang_cc1 -o - -triple %itanium_abi_triple -emit-llvm %s | FileCheck %s
// PR5483
// Make sure we generate all three forms of the destructor when it is virtual.
@@ -7,4 +7,4 @@
};
Foo::~Foo() {}
-// CHECK-LABEL: define void @_ZN3FooD0Ev(%class.Foo* %this) unnamed_addr
+// CHECK-LABEL: define {{.*}}void @_ZN3FooD0Ev(%class.Foo* %this) unnamed_addr
diff --git a/test/CodeGenCXX/virt-dtor-key.cpp b/test/CodeGenCXX/virt-dtor-key.cpp
index a8fa371..40c5a53 100644
--- a/test/CodeGenCXX/virt-dtor-key.cpp
+++ b/test/CodeGenCXX/virt-dtor-key.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
-// CHECK: @_ZTI3foo = unnamed_addr constant
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+// CHECK: @_ZTI3foo = constant
class foo {
foo();
virtual ~foo();
diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp
index a6067d6..a71db48 100644
--- a/test/CodeGenCXX/virt-template-vtable.cpp
+++ b/test/CodeGenCXX/virt-template-vtable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
template<class T> class A {
public:
diff --git a/test/CodeGenCXX/virtual-base-cast.cpp b/test/CodeGenCXX/virtual-base-cast.cpp
index 40e68f6..6a4894b 100644
--- a/test/CodeGenCXX/virtual-base-cast.cpp
+++ b/test/CodeGenCXX/virtual-base-cast.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 -cxx-abi microsoft -emit-llvm %s -o - -triple i686-pc-win32 | FileCheck -check-prefix MSVC %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-win32 | FileCheck -check-prefix MSVC %s
struct A { int a; virtual int aa(); };
struct B { int b; virtual int bb(); };
diff --git a/test/CodeGenCXX/virtual-base-ctor.cpp b/test/CodeGenCXX/virtual-base-ctor.cpp
index 2d81ebd..8c28965 100644
--- a/test/CodeGenCXX/virtual-base-ctor.cpp
+++ b/test/CodeGenCXX/virtual-base-ctor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -O2 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - -O2 | FileCheck %s
struct B;
extern B x;
diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp
index 5014eaf..3d79071 100644
--- a/test/CodeGenCXX/virtual-base-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
struct basic_ios{~basic_ios(); };
diff --git a/test/CodeGenCXX/virtual-bases.cpp b/test/CodeGenCXX/virtual-bases.cpp
index 2878e95..e9c568c 100644
--- a/test/CodeGenCXX/virtual-bases.cpp
+++ b/test/CodeGenCXX/virtual-bases.cpp
@@ -12,16 +12,16 @@
B();
};
-// CHECK-LABEL: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
// CHECK-LABEL: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt) unnamed_addr
+// CHECK-LABEL: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
B::B() { }
struct C : virtual A {
C(bool);
};
-// CHECK-LABEL: define void @_ZN1CC1Eb(%struct.C* %this, i1 zeroext) unnamed_addr
// CHECK-LABEL: define void @_ZN1CC2Eb(%struct.C* %this, i8** %vtt, i1 zeroext) unnamed_addr
+// CHECK-LABEL: define void @_ZN1CC1Eb(%struct.C* %this, i1 zeroext) unnamed_addr
C::C(bool) { }
// PR6251
diff --git a/test/CodeGenCXX/virtual-destructor-calls.cpp b/test/CodeGenCXX/virtual-destructor-calls.cpp
index ae3704f..3e7fa82 100644
--- a/test/CodeGenCXX/virtual-destructor-calls.cpp
+++ b/test/CodeGenCXX/virtual-destructor-calls.cpp
@@ -20,16 +20,16 @@
// CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
// CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
-// Deleting dtor: defers to the complete dtor.
-// CHECK-LABEL: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
-// CHECK: call void @_ZN1BD1Ev
-// CHECK: call void @_ZdlPv
-
// Base dtor: actually calls A's base dtor.
// CHECK-LABEL: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
// CHECK: call void @_ZN6MemberD1Ev
// CHECK: call void @_ZN1AD2Ev
+// Deleting dtor: defers to the complete dtor.
+// CHECK-LABEL: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
+// CHECK: call void @_ZN1BD1Ev
+// CHECK: call void @_ZdlPv
+
B::~B() { }
struct C : B {
diff --git a/test/CodeGenCXX/virtual-destructor-synthesis.cpp b/test/CodeGenCXX/virtual-destructor-synthesis.cpp
index 90f66a8..80d1b1e 100644
--- a/test/CodeGenCXX/virtual-destructor-synthesis.cpp
+++ b/test/CodeGenCXX/virtual-destructor-synthesis.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
struct box {
virtual ~box();
diff --git a/test/CodeGenCXX/virtual-function-calls.cpp b/test/CodeGenCXX/virtual-function-calls.cpp
index e1b380f..0a6fc6b 100644
--- a/test/CodeGenCXX/virtual-function-calls.cpp
+++ b/test/CodeGenCXX/virtual-function-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - | FileCheck %s
// PR5021
namespace PR5021 {
@@ -8,7 +8,7 @@
};
void f(A *a) {
- // CHECK: call void %
+ // CHECK: call {{.*}}void %
a->f('c');
}
@@ -45,7 +45,7 @@
// CHECK: @_ZN15VirtualNoreturn1f
void f(A *p) {
p->f();
- // CHECK: call void %{{[^#]*$}}
+ // CHECK: call {{.*}}void %{{[^#]*$}}
// CHECK-NOT: unreachable
}
}
diff --git a/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
index 70bc6fc..0310465 100644
--- a/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
+++ b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
struct D;
struct B {
diff --git a/test/CodeGenCXX/virtual-implicit-move-assignment.cpp b/test/CodeGenCXX/virtual-implicit-move-assignment.cpp
index d8ac1ed..7c28fb1 100644
--- a/test/CodeGenCXX/virtual-implicit-move-assignment.cpp
+++ b/test/CodeGenCXX/virtual-implicit-move-assignment.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -std=c++11 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -std=c++11 -o - %s | FileCheck %s
struct D;
struct B {
diff --git a/test/CodeGenCXX/virtual-inherited-destructor.cpp b/test/CodeGenCXX/virtual-inherited-destructor.cpp
index 509d40a..3ca7b6d 100644
--- a/test/CodeGenCXX/virtual-inherited-destructor.cpp
+++ b/test/CodeGenCXX/virtual-inherited-destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm-only
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm-only
struct A { virtual ~A(); };
struct B : A {
diff --git a/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp b/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
index 0d3574e..b14a34d 100644
--- a/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
struct A {
virtual ~A();
diff --git a/test/CodeGenCXX/visibility-hidden-extern-templates.cpp b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
index 549e674..95e8e08 100644
--- a/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
+++ b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
+// RUN: %clang_cc1 -O1 -triple %itanium_abi_triple -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
template<typename T>
struct X {
@@ -14,13 +14,13 @@
// <rdar://problem/8109763>
void test_X(X<int> xi, X<char> xc) {
- // CHECK-LABEL: define weak_odr hidden void @_ZN1XIiE1fEv
+ // CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1XIiE1fEv
xi.f();
- // CHECK-LABEL: define weak_odr hidden void @_ZN1XIiE1gEv
+ // CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1XIiE1gEv
xi.g();
- // CHECK: declare void @_ZN1XIcE1fEv
+ // CHECK: declare {{.*}}void @_ZN1XIcE1fEv
xc.f();
- // CHECK-LABEL: define available_externally void @_ZN1XIcE1gEv
+ // CHECK-LABEL: define available_externally {{.*}}void @_ZN1XIcE1gEv
xc.g();
}
diff --git a/test/CodeGenCXX/visibility-ms-compat.cpp b/test/CodeGenCXX/visibility-ms-compat.cpp
index 25446cd..963b2a4 100644
--- a/test/CodeGenCXX/visibility-ms-compat.cpp
+++ b/test/CodeGenCXX/visibility-ms-compat.cpp
@@ -27,7 +27,7 @@
const std::type_info &ti = typeid(A);
// CHECK-GLOBAL: @_ZTSN5test01AE = linkonce_odr constant
- // CHECK-GLOBAL: @_ZTIN5test01AE = linkonce_odr unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test01AE = linkonce_odr constant
// CHECK-GLOBAL: @_ZN5test02tiE = hidden constant
}
@@ -43,7 +43,7 @@
const std::type_info &ti = typeid(A);
// CHECK-GLOBAL: @_ZTSN5test11AE = linkonce_odr hidden constant
- // CHECK-GLOBAL: @_ZTIN5test11AE = linkonce_odr hidden unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test11AE = linkonce_odr hidden constant
// CHECK-GLOBAL: @_ZN5test12tiE = hidden constant
}
@@ -59,7 +59,7 @@
const std::type_info &ti = typeid(A);
// CHECK-GLOBAL: @_ZTSN5test21AE = linkonce_odr constant
- // CHECK-GLOBAL: @_ZTIN5test21AE = linkonce_odr unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test21AE = linkonce_odr constant
// CHECK-GLOBAL: @_ZN5test22tiE = hidden constant
}
@@ -76,7 +76,7 @@
const std::type_info &ti = typeid(B<A>);
// CHECK-GLOBAL: @_ZTSN5test31BINS_1AEEE = linkonce_odr constant
- // CHECK-GLOBAL: @_ZTIN5test31BINS_1AEEE = linkonce_odr unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test31BINS_1AEEE = linkonce_odr constant
}
namespace test4 {
@@ -92,7 +92,7 @@
const std::type_info &ti = typeid(B<A>);
// CHECK-GLOBAL: @_ZTSN5test41BINS_1AEEE = linkonce_odr constant
- // CHECK-GLOBAL: @_ZTIN5test41BINS_1AEEE = linkonce_odr unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test41BINS_1AEEE = linkonce_odr constant
}
namespace test5 {
@@ -108,5 +108,5 @@
const std::type_info &ti = typeid(B<A>);
// CHECK-GLOBAL: @_ZTSN5test51BINS_1AEEE = linkonce_odr hidden constant
- // CHECK-GLOBAL: @_ZTIN5test51BINS_1AEEE = linkonce_odr hidden unnamed_addr constant
+ // CHECK-GLOBAL: @_ZTIN5test51BINS_1AEEE = linkonce_odr hidden constant
}
diff --git a/test/CodeGenCXX/volatile-1.cpp b/test/CodeGenCXX/volatile-1.cpp
index 71ff1ed..2038936 100644
--- a/test/CodeGenCXX/volatile-1.cpp
+++ b/test/CodeGenCXX/volatile-1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-unused-value -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
// CHECK: @i = global [[INT:i[0-9]+]] 0
volatile int i, j, k;
@@ -248,11 +248,11 @@
// gcc.
// Not a use. gcc forgets to do the assignment.
- // CHECK-NEXT: call
+ // CHECK-NEXT: call {{.*}}void
((a=a),a);
// Not a use. gcc gets this wrong, it doesn't emit the copy!
- // CHECK-NEXT: call
+ // CHECK-NEXT: call {{.*}}void
(void)(a=a);
// Not a use. gcc got this wrong in 4.2 and omitted the side effects
diff --git a/test/CodeGenCXX/vtable-available-externally.cpp b/test/CodeGenCXX/vtable-available-externally.cpp
index 282bd2a..e07d484 100644
--- a/test/CodeGenCXX/vtable-available-externally.cpp
+++ b/test/CodeGenCXX/vtable-available-externally.cpp
@@ -35,7 +35,7 @@
// updated correctly.
// CHECK-TEST2: @_ZTSN5Test21AE = constant
-// CHECK-TEST2: @_ZTIN5Test21AE = unnamed_addr constant
+// CHECK-TEST2: @_ZTIN5Test21AE = constant
// CHECK-TEST2: @_ZTVN5Test21AE = unnamed_addr constant
namespace Test2 {
struct A {
diff --git a/test/CodeGenCXX/vtable-cast-crash.cpp b/test/CodeGenCXX/vtable-cast-crash.cpp
index cc419fd..58f9e0b 100644
--- a/test/CodeGenCXX/vtable-cast-crash.cpp
+++ b/test/CodeGenCXX/vtable-cast-crash.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple %s
struct A
{
A();
diff --git a/test/CodeGenCXX/vtable-key-function-arm.cpp b/test/CodeGenCXX/vtable-key-function-arm.cpp
index 08efe8a..6f1265b 100644
--- a/test/CodeGenCXX/vtable-key-function-arm.cpp
+++ b/test/CodeGenCXX/vtable-key-function-arm.cpp
@@ -4,7 +4,7 @@
// The 'a' variants ask for the v-table first.
// The 'b' variants ask for the v-table second.
// The 'c' variants ask for the v-table third.
-// We do a separate CHECK-LATE pass because the RTTI defintion gets
+// We do a separate CHECK-LATE pass because the RTTI definition gets
// changed after the fact, which causes reordering of the globals.
// These are not separated into namespaces because the way that Sema
@@ -91,7 +91,7 @@
Test2a::Test2a() { use(typeid(Test2a)); }
// CHECK: @_ZTV6Test2a = unnamed_addr constant
// CHECK-LATE: @_ZTS6Test2a = constant
-// CHECK-LATE: @_ZTI6Test2a = unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test2a = constant
// 'bar' becomes the key function when 'foo' is defined inline.
void Test2a::bar() {}
@@ -112,7 +112,7 @@
Test2b::Test2b() { use(typeid(Test2b)); }
// CHECK: @_ZTV6Test2b = unnamed_addr constant
// CHECK-LATE: @_ZTS6Test2b = constant
-// CHECK-LATE: @_ZTI6Test2b = unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test2b = constant
inline void Test2b::foo() {}
@@ -132,7 +132,7 @@
Test2c::Test2c() { use(typeid(Test2c)); }
// CHECK: @_ZTV6Test2c = unnamed_addr constant
// CHECK: @_ZTS6Test2c = constant
-// CHECK: @_ZTI6Test2c = unnamed_addr constant
+// CHECK: @_ZTI6Test2c = constant
/*** Test3a ******************************************************************/
@@ -146,7 +146,7 @@
Test3a::Test3a() { use(typeid(Test3a)); }
// CHECK: @_ZTV6Test3a = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test3a = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test3a = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test3a = linkonce_odr constant
// There ceases to be a key function after these declarations.
inline void Test3a::bar() {}
@@ -167,7 +167,7 @@
Test3b::Test3b() { use(typeid(Test3b)); }
// CHECK: @_ZTV6Test3b = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test3b = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test3b = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test3b = linkonce_odr constant
inline void Test3b::foo() {}
@@ -187,7 +187,7 @@
Test3c::Test3c() { use(typeid(Test3c)); }
// CHECK: @_ZTV6Test3c = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test3c = linkonce_odr constant
-// CHECK: @_ZTI6Test3c = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test3c = linkonce_odr constant
/*** Test4a ******************************************************************/
@@ -201,7 +201,7 @@
template <> Test4a<int>::Test4a() { use(typeid(Test4a)); }
// CHECK: @_ZTV6Test4aIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test4aIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test4aIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test4aIiE = linkonce_odr constant
// There ceases to be a key function after these declarations.
template <> inline void Test4a<int>::bar() {}
@@ -222,7 +222,7 @@
template <> Test4b<int>::Test4b() { use(typeid(Test4b)); }
// CHECK: @_ZTV6Test4bIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test4bIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test4bIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test4bIiE = linkonce_odr constant
template <> inline void Test4b<int>::foo() {}
@@ -242,7 +242,7 @@
template <> Test4c<int>::Test4c() { use(typeid(Test4c)); }
// CHECK: @_ZTV6Test4cIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test4cIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test4cIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test4cIiE = linkonce_odr constant
/*** Test5a ******************************************************************/
@@ -259,7 +259,7 @@
template <> Test5a<int>::Test5a() { use(typeid(Test5a)); }
// CHECK: @_ZTV6Test5aIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test5aIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test5aIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test5aIiE = linkonce_odr constant
// There ceases to be a key function after these declarations.
template <> inline void Test5a<int>::bar() {}
@@ -281,7 +281,7 @@
template <> Test5b<int>::Test5b() { use(typeid(Test5b)); }
// CHECK: @_ZTV6Test5bIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test5bIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test5bIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test5bIiE = linkonce_odr constant
template <> inline void Test5a<int>::foo();
template <> inline void Test5b<int>::foo() {}
@@ -304,4 +304,4 @@
template <> Test5c<int>::Test5c() { use(typeid(Test5c)); }
// CHECK: @_ZTV6Test5cIiE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test5cIiE = linkonce_odr constant
-// CHECK: @_ZTI6Test5cIiE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test5cIiE = linkonce_odr constant
diff --git a/test/CodeGenCXX/vtable-key-function-ios.cpp b/test/CodeGenCXX/vtable-key-function-ios.cpp
index bcd3e88..bf2e1f9 100644
--- a/test/CodeGenCXX/vtable-key-function-ios.cpp
+++ b/test/CodeGenCXX/vtable-key-function-ios.cpp
@@ -4,7 +4,7 @@
// The 'a' variants ask for the v-table first.
// The 'b' variants ask for the v-table second.
// The 'c' variants ask for the v-table third.
-// We do a separate CHECK-LATE pass because the RTTI defintion gets
+// We do a separate CHECK-LATE pass because the RTTI definition gets
// changed after the fact, which causes reordering of the globals.
// These are not separated into namespaces because the way that Sema
@@ -59,7 +59,7 @@
Test1a::Test1a() { use(typeid(Test1a)); }
// CHECK: @_ZTV6Test1a = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test1a = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test1a = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test1a = linkonce_odr constant
// This defines the key function.
inline void Test1a::foo() {}
@@ -79,7 +79,7 @@
Test1b::Test1b() { use(typeid(Test1b)); }
// CHECK: @_ZTV6Test1b = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test1b = linkonce_odr constant
-// CHECK: @_ZTI6Test1b = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test1b = linkonce_odr constant
/*** Test2a ******************************************************************/
@@ -93,7 +93,7 @@
Test2a::Test2a() { use(typeid(Test2a)); }
// CHECK: @_ZTV6Test2a = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test2a = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test2a = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test2a = linkonce_odr constant
void Test2a::bar() {}
inline void Test2a::foo() {}
@@ -112,7 +112,7 @@
Test2b::Test2b() { use(typeid(Test2b)); }
// CHECK: @_ZTV6Test2b = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test2b = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test2b = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test2b = linkonce_odr constant
inline void Test2b::foo() {}
@@ -131,7 +131,7 @@
Test2c::Test2c() { use(typeid(Test2c)); }
// CHECK: @_ZTV6Test2c = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test2c = linkonce_odr constant
-// CHECK: @_ZTI6Test2c = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test2c = linkonce_odr constant
/*** Test3a ******************************************************************/
@@ -145,7 +145,7 @@
Test3a::Test3a() { use(typeid(Test3a)); }
// CHECK: @_ZTV6Test3a = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test3a = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test3a = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test3a = linkonce_odr constant
// This defines the key function.
inline void Test3a::bar() {}
@@ -165,7 +165,7 @@
Test3b::Test3b() { use(typeid(Test3b)); }
// CHECK: @_ZTV6Test3b = linkonce_odr unnamed_addr constant
// CHECK-LATE: @_ZTS6Test3b = linkonce_odr constant
-// CHECK-LATE: @_ZTI6Test3b = linkonce_odr unnamed_addr constant
+// CHECK-LATE: @_ZTI6Test3b = linkonce_odr constant
// This defines the key function.
inline void Test3b::foo() {}
@@ -186,4 +186,4 @@
Test3c::Test3c() { use(typeid(Test3c)); }
// CHECK: @_ZTV6Test3c = linkonce_odr unnamed_addr constant
// CHECK: @_ZTS6Test3c = linkonce_odr constant
-// CHECK: @_ZTI6Test3c = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI6Test3c = linkonce_odr constant
diff --git a/test/CodeGenCXX/vtable-layout-abi-examples.cpp b/test/CodeGenCXX/vtable-layout-abi-examples.cpp
index 8f084a9..b8ac6f5 100644
--- a/test/CodeGenCXX/vtable-layout-abi-examples.cpp
+++ b/test/CodeGenCXX/vtable-layout-abi-examples.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>&1
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>/dev/null
// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index c17e333..9c08b30 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -1,8 +1,6 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o %t.hidden
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -disable-llvm-optzns -O3 -emit-llvm -o %t.opt
// RUN: FileCheck --check-prefix=CHECK %s < %t
-// RUN: FileCheck --check-prefix=CHECK-HIDDEN %s < %t.hidden
// RUN: FileCheck --check-prefix=CHECK-OPT %s < %t.opt
namespace {
@@ -93,57 +91,47 @@
// and hidden visibility (rdar://problem/7523229).
// CHECK-DAG: @_ZTV1C = linkonce_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1C = linkonce_odr constant
-// CHECK-DAG: @_ZTI1C = linkonce_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1C = linkonce_odr constant
// CHECK-DAG: @_ZTT1C = linkonce_odr unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTV1C = linkonce_odr hidden unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTS1C = linkonce_odr constant
-// CHECK-HIDDEN-DAG: @_ZTI1C = linkonce_odr hidden unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTT1C = linkonce_odr hidden unnamed_addr constant
// D has a key function that is defined in this translation unit so its vtable is
// defined in the translation unit.
// CHECK-DAG: @_ZTV1D = unnamed_addr constant
// CHECK-DAG: @_ZTS1D = constant
-// CHECK-DAG: @_ZTI1D = unnamed_addr constant
+// CHECK-DAG: @_ZTI1D = constant
// E<char> is an explicit specialization with a key function defined
// in this translation unit, so its vtable should have external
// linkage.
// CHECK-DAG: @_ZTV1EIcE = unnamed_addr constant
// CHECK-DAG: @_ZTS1EIcE = constant
-// CHECK-DAG: @_ZTI1EIcE = unnamed_addr constant
+// CHECK-DAG: @_ZTI1EIcE = constant
// E<short> is an explicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
// CHECK-DAG: @_ZTV1EIsE = weak_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1EIsE = weak_odr constant
-// CHECK-DAG: @_ZTI1EIsE = weak_odr unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTV1EIsE = weak_odr unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTS1EIsE = weak_odr constant
-// CHECK-HIDDEN-DAG: @_ZTI1EIsE = weak_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1EIsE = weak_odr constant
// F<short> is an explicit template instantiation without a key
// function, so its vtable should have weak_odr linkage
// CHECK-DAG: @_ZTV1FIsE = weak_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1FIsE = weak_odr constant
-// CHECK-DAG: @_ZTI1FIsE = weak_odr unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTV1FIsE = weak_odr unnamed_addr constant
-// CHECK-HIDDEN-DAG: @_ZTS1FIsE = weak_odr constant
-// CHECK-HIDDEN-DAG: @_ZTI1FIsE = weak_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1FIsE = weak_odr constant
// E<long> is an implicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// linkonce_odr linkage.
// CHECK-DAG: @_ZTV1EIlE = linkonce_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1EIlE = linkonce_odr constant
-// CHECK-DAG: @_ZTI1EIlE = linkonce_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1EIlE = linkonce_odr constant
// F<long> is an implicit template instantiation with no key function,
// so its vtable should have linkonce_odr linkage.
// CHECK-DAG: @_ZTV1FIlE = linkonce_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1FIlE = linkonce_odr constant
-// CHECK-DAG: @_ZTI1FIlE = linkonce_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1FIlE = linkonce_odr constant
// F<int> is an explicit template instantiation declaration without a
// key function, so its vtable should have external linkage.
@@ -160,19 +148,19 @@
// internal linkage.
// CHECK-DAG: @"_ZTV3$_0" = internal unnamed_addr constant
// CHECK-DAG: @"_ZTS3$_0" = internal constant
-// CHECK-DAG: @"_ZTI3$_0" = internal unnamed_addr constant
+// CHECK-DAG: @"_ZTI3$_0" = internal constant
// The A vtable should have internal linkage since it is inside an anonymous
// namespace.
// CHECK-DAG: @_ZTVN12_GLOBAL__N_11AE = internal unnamed_addr constant
// CHECK-DAG: @_ZTSN12_GLOBAL__N_11AE = internal constant
-// CHECK-DAG: @_ZTIN12_GLOBAL__N_11AE = internal unnamed_addr constant
+// CHECK-DAG: @_ZTIN12_GLOBAL__N_11AE = internal constant
// F<char> is an explicit specialization without a key function, so
// its vtable should have linkonce_odr linkage.
// CHECK-DAG: @_ZTV1FIcE = linkonce_odr unnamed_addr constant
// CHECK-DAG: @_ZTS1FIcE = linkonce_odr constant
-// CHECK-DAG: @_ZTI1FIcE = linkonce_odr unnamed_addr constant
+// CHECK-DAG: @_ZTI1FIcE = linkonce_odr constant
// CHECK-DAG: @_ZTV1GIiE = linkonce_odr unnamed_addr constant
template <typename T>
diff --git a/test/CodeGenCXX/weak-extern-typeinfo.cpp b/test/CodeGenCXX/weak-extern-typeinfo.cpp
index 3c3406e..38f6a3e 100644
--- a/test/CodeGenCXX/weak-extern-typeinfo.cpp
+++ b/test/CodeGenCXX/weak-extern-typeinfo.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
// rdar://10246395
#define WEAK __attribute__ ((weak))
@@ -32,16 +32,16 @@
void V2::foo() { }
// CHECK: @_ZTS1A = weak_odr constant
-// CHECK: @_ZTI1A = weak_odr unnamed_addr constant
+// CHECK: @_ZTI1A = weak_odr constant
// CHECK: @_ZTS1B = weak_odr constant
-// CHECK: @_ZTI1B = weak_odr unnamed_addr constant
+// CHECK: @_ZTI1B = weak_odr constant
// CHECK: @_ZTS1C = weak_odr constant
// CHECK: @_ZTS2T1 = linkonce_odr constant
-// CHECK: @_ZTI2T1 = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTI2T1 = linkonce_odr constant
// CHECK: @_ZTS1T = linkonce_odr constant
-// CHECK: @_ZTI1T = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTI1C = weak_odr unnamed_addr constant
+// CHECK: @_ZTI1T = linkonce_odr constant
+// CHECK: @_ZTI1C = weak_odr constant
// CHECK: @_ZTS2V1 = weak_odr constant
-// CHECK: @_ZTI2V1 = weak_odr unnamed_addr constant
+// CHECK: @_ZTI2V1 = weak_odr constant
// CHECK: @_ZTS2V2 = weak_odr constant
-// CHECK: @_ZTI2V2 = weak_odr unnamed_addr constant
+// CHECK: @_ZTI2V2 = weak_odr constant
diff --git a/test/CodeGenCXX/weak-external.cpp b/test/CodeGenCXX/weak-external.cpp
index dad54f6..a2c53a5 100644
--- a/test/CodeGenCXX/weak-external.cpp
+++ b/test/CodeGenCXX/weak-external.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -fexceptions %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple %itanium_abi_triple %s -S -emit-llvm -o - | FileCheck %s
// PR4262
// CHECK-NOT: _ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag