diff options
Diffstat (limited to 'test/CodeGenCXX')
44 files changed, 251 insertions, 104 deletions
diff --git a/test/CodeGenCXX/PR5093-static-member-function.cpp b/test/CodeGenCXX/PR5093-static-member-function.cpp index d61a87ac16dc..681135182bf2 100644 --- a/test/CodeGenCXX/PR5093-static-member-function.cpp +++ b/test/CodeGenCXX/PR5093-static-member-function.cpp @@ -4,6 +4,6 @@ struct a { }; void g(a *a) { - // CHECK: call void @_ZN1a1fEv() + // CHECK: call {{.*}}void @_ZN1a1fEv() a->f(); } diff --git a/test/CodeGenCXX/address-of-fntemplate.cpp b/test/CodeGenCXX/address-of-fntemplate.cpp index 4ff597acb304..4840fe89edb8 100644 --- a/test/CodeGenCXX/address-of-fntemplate.cpp +++ b/test/CodeGenCXX/address-of-fntemplate.cpp @@ -9,8 +9,8 @@ void test() { // CHECK: @_Z1fIiEvv void (*p2)() = f<int>; } -// CHECK-LABEL: define linkonce_odr void @_Z1fIiEvT_ -// CHECK-LABEL: define linkonce_odr void @_Z1fIiEvv +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z1fIiEvT_ +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z1fIiEvv namespace PR6973 { template<typename T> diff --git a/test/CodeGenCXX/attr-cleanup.cpp b/test/CodeGenCXX/attr-cleanup.cpp index 18a7798481e9..5ece41a29947 100644 --- a/test/CodeGenCXX/attr-cleanup.cpp +++ b/test/CodeGenCXX/attr-cleanup.cpp @@ -5,7 +5,7 @@ namespace N { } int main(void) { - // CHECK: call void @_ZN1N4freeEPv + // CHECK: call {{.*}}void @_ZN1N4freeEPv void *fp __attribute__((cleanup(N::free))); return 0; } diff --git a/test/CodeGenCXX/block-byref-cxx-objc.cpp b/test/CodeGenCXX/block-byref-cxx-objc.cpp index 5c35ad72a20d..ce1ebd615ef8 100644 --- a/test/CodeGenCXX/block-byref-cxx-objc.cpp +++ b/test/CodeGenCXX/block-byref-cxx-objc.cpp @@ -20,9 +20,9 @@ int main() // CHECK-LABEL: define internal void @__Block_byref_object_dispose_ // CHECK: call {{.*}} @_ZN1AD1Ev // CHECK-LABEL: define internal void @__copy_helper_block_ -// CHECK: call void @_Block_object_assign +// CHECK: call {{.*}}void @_Block_object_assign // CHECK-LABEL: define internal void @__destroy_helper_block_ -// CHECK: call void @_Block_object_dispose +// CHECK: call {{.*}}void @_Block_object_dispose // rdar://problem/11135650 namespace test1 { diff --git a/test/CodeGenCXX/c-linkage.cpp b/test/CodeGenCXX/c-linkage.cpp index 2f8729e4971a..a70a22ef08c7 100644 --- a/test/CodeGenCXX/c-linkage.cpp +++ b/test/CodeGenCXX/c-linkage.cpp @@ -15,10 +15,10 @@ extern "C" { extern "C" { static void test2_f() { } - // CHECK-LABEL: define internal void @_Z7test2_fv + // CHECK-LABEL: define internal {{.*}}void @_Z7test2_fv static void test2_f(int x) { } - // CHECK-LABEL: define internal void @_Z7test2_fi + // CHECK-LABEL: define internal {{.*}}void @_Z7test2_fi void test2_use() { test2_f(); test2_f(42); diff --git a/test/CodeGenCXX/captured-statements.cpp b/test/CodeGenCXX/captured-statements.cpp index ebb38334d07c..fdda24fcf301 100644 --- a/test/CodeGenCXX/captured-statements.cpp +++ b/test/CodeGenCXX/captured-statements.cpp @@ -44,11 +44,11 @@ void test1() { // CHECK-1: ret } -// CHECK-1: define internal void @[[HelperName]] +// CHECK-1: define internal {{.*}}void @[[HelperName]] // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 0 -// CHECK-1: call i32 @__cxa_guard_acquire( +// CHECK-1: call {{.*}}i32 @__cxa_guard_acquire( // CHECK-1: store double %{{.+}}, double* [[INNER]], -// CHECK-1: call void @__cxa_guard_release( +// CHECK-1: call {{.*}}void @__cxa_guard_release( // CHECK-1: getelementptr inbounds %struct.TestClass, %struct.TestClass* {{[^,]*}}, i32 0, i32 0 // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 1 @@ -61,13 +61,13 @@ void test2(int x) { return x; }(); - // CHECK-2-LABEL: define void @_Z5test2i + // CHECK-2-LABEL: define {{.*}}void @_Z5test2i // CHECK-2: call {{.*}} @[[Lambda:["$\w]+]] // // CHECK-2: define internal {{.*}} @[[Lambda]] // CHECK-2: call void @[[HelperName:["$_A-Za-z0-9]+]](%[[Capture:.*]]* // - // CHECK-2: define internal void @[[HelperName]] + // CHECK-2: define internal {{.*}}void @[[HelperName]] // CHECK-2: getelementptr inbounds %[[Capture]], %[[Capture]]* // CHECK-2: load i32*, i32** // CHECK-2: load i32, i32* @@ -81,7 +81,7 @@ void test3(int x) { // CHECK-3: %[[Capture:struct\.anon[\.0-9]*]] = type { i32* } - // CHECK-3-LABEL: define void @_Z5test3i + // CHECK-3-LABEL: define {{.*}}void @_Z5test3i // CHECK-3: store i32* // CHECK-3: call void @{{.*}}__captured_stmt // CHECK-3: ret void @@ -93,11 +93,11 @@ void test4() { Foo f; f.x = 5; } - // CHECK-4-LABEL: define void @_Z5test4v + // CHECK-4-LABEL: define {{.*}}void @_Z5test4v // CHECK-4: call void @[[HelperName:[\."$_A-Za-z0-9]+]](%[[Capture:.*]]* // CHECK-4: ret void // - // CHECK-4: define internal void @[[HelperName]] + // CHECK-4: define internal {{.*}}void @[[HelperName]] // CHECK-4: store i32 5, i32* // CHECK-4: call {{.*}}FooD1Ev } diff --git a/test/CodeGenCXX/constructor-attr.cpp b/test/CodeGenCXX/constructor-attr.cpp index 468ce36688f7..ec27ed210ce7 100644 --- a/test/CodeGenCXX/constructor-attr.cpp +++ b/test/CodeGenCXX/constructor-attr.cpp @@ -5,7 +5,7 @@ // PR6521 void bar(); struct Foo { - // CHECK-LABEL: define linkonce_odr void @_ZN3Foo3fooEv + // CHECK-LABEL: define linkonce_odr {{.*}}void @_ZN3Foo3fooEv static void foo() __attribute__((constructor)) { bar(); } diff --git a/test/CodeGenCXX/ctor-globalopt.cpp b/test/CodeGenCXX/ctor-globalopt.cpp index 26ec523c553b..bcab60916aec 100644 --- a/test/CodeGenCXX/ctor-globalopt.cpp +++ b/test/CodeGenCXX/ctor-globalopt.cpp @@ -11,8 +11,8 @@ // CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] // CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_ctor_globalopt.cpp, i8* null }] -// CHECK-LABEL: define internal void @_GLOBAL__sub_I_ctor_globalopt.cpp() -// CHECK: call void @ +// CHECK-LABEL: define internal {{.*}}void @_GLOBAL__sub_I_ctor_globalopt.cpp() +// CHECK: call {{.*}}void @ // CHECK-NOT: call{{ }} // O1: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index 0b1b43b86f3c..7f8e117315c0 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -158,7 +158,7 @@ __complex double f11() { void f12() { int f12_1(); void f12_2(int = f12_1()); -// CHECK: call {{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]] +// CHECK: call {{.*}}{{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]] #line 1400 f12_2(); } diff --git a/test/CodeGenCXX/debug-info-method-nodebug.cpp b/test/CodeGenCXX/debug-info-method-nodebug.cpp new file mode 100644 index 000000000000..474053a4caa9 --- /dev/null +++ b/test/CodeGenCXX/debug-info-method-nodebug.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s + +class C { + void present(); + void absent() __attribute__((nodebug)); +}; + +C c; + +// CHECK-NOT: name: "absent" +// CHECK: name: "present" +// CHECK-NOT: name: "absent" diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index d59b778676c4..35b371ec9c9d 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -55,7 +55,7 @@ void B::func_fwd() {} // This should work even if 'i' and 'func' were declarations & not definitions, // but it doesn't yet. -// CHECK: [[CU:![0-9]+]] = !DICompileUnit( +// CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-SAME: imports: [[MODULES:![0-9]*]] // CHECK: [[FOO:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", // CHECK-SAME: line: 5 @@ -102,7 +102,7 @@ void B::func_fwd() {} // CHECK: [[M16]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_FWD:![0-9]+]] // CHECK: [[M17]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CTXT]], entity: [[I]] -// CHECK-GMLT: [[CU:![0-9]+]] = !DICompileUnit( +// CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-GMLT-SAME: emissionKind: 2, // CHECK-GMLT-SAME: imports: [[MODULES:![0-9]+]] // CHECK-GMLT: [[MODULES]] = !{} diff --git a/test/CodeGenCXX/deferred-global-init.cpp b/test/CodeGenCXX/deferred-global-init.cpp index 920037c25356..e4c0d075568d 100644 --- a/test/CodeGenCXX/deferred-global-init.cpp +++ b/test/CodeGenCXX/deferred-global-init.cpp @@ -7,10 +7,10 @@ void* bar() { return a; } // CHECK: @_ZL1a = internal global i8* null -// CHECK-LABEL: define internal void @__cxx_global_var_init +// CHECK-LABEL: define internal {{.*}}void @__cxx_global_var_init // CHECK: load i8*, i8** @foo // CHECK: ret void -// CHECK-LABEL: define internal void @_GLOBAL__sub_I_deferred_global_init.cpp -// CHECK: call void @__cxx_global_var_init() +// CHECK-LABEL: define internal {{.*}}void @_GLOBAL__sub_I_deferred_global_init.cpp +// CHECK: call {{.*}}void @__cxx_global_var_init() // CHECK: ret void 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 dd64e8123081..3a4766de321a 100644 --- a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp +++ b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp @@ -9,7 +9,7 @@ struct D final : virtual C { virtual void f(); }; -// CHECK-LABEL: define dereferenceable({{[0-9]+}}) %struct.B* @_Z1fR1D +// CHECK-LABEL: define {{.*}}dereferenceable({{[0-9]+}}) %struct.B* @_Z1fR1D B &f(D &d) { // CHECK-NOT: load i8*, i8** return d; diff --git a/test/CodeGenCXX/destructor-crash.cpp b/test/CodeGenCXX/destructor-crash.cpp new file mode 100644 index 000000000000..43291986514d --- /dev/null +++ b/test/CodeGenCXX/destructor-crash.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -emit-llvm -std=c++11 -o %t + +struct A { + ~A(); +}; + +struct B { + A a; +}; + +struct C { + union { + B b; + }; + + ~C() noexcept; +}; + +C::~C() noexcept {} diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 0eb6476bd0ec..c598880b625e 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -486,7 +486,7 @@ struct S { struct CtorWithClosure { __declspec(dllexport) CtorWithClosure(...) {} -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ"({{.*}}) comdat // M32-DAG: %[[this_addr:.*]] = alloca %struct.CtorWithClosure*, align 4 // M32-DAG: store %struct.CtorWithClosure* %this, %struct.CtorWithClosure** %[[this_addr]], align 4 // M32-DAG: %[[this:.*]] = load %struct.CtorWithClosure*, %struct.CtorWithClosure** %[[this_addr]] @@ -503,7 +503,7 @@ struct CtorWithClosure { struct __declspec(dllexport) ClassWithClosure { DELETE_IMPLICIT_MEMBERS(ClassWithClosure); ClassWithClosure(...) {} -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ"({{.*}}) comdat // M32-DAG: %[[this_addr:.*]] = alloca %struct.ClassWithClosure*, align 4 // M32-DAG: store %struct.ClassWithClosure* %this, %struct.ClassWithClosure** %[[this_addr]], align 4 // M32-DAG: %[[this:.*]] = load %struct.ClassWithClosure*, %struct.ClassWithClosure** %[[this_addr]] @@ -520,8 +520,8 @@ struct __declspec(dllexport) NestedOuter { }; }; -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ" -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ"({{.*}}) comdat +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ"({{.*}}) comdat template <typename T> struct SomeTemplate { @@ -530,7 +530,7 @@ struct SomeTemplate { }; struct __declspec(dllexport) InheritFromTemplate : SomeTemplate<int> {}; -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ"({{.*}}) comdat namespace PR23801 { template <typename> @@ -546,7 +546,7 @@ struct __declspec(dllexport) B { }; } // -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ"({{.*}}) comdat struct __declspec(dllexport) T { // Copy assignment operator: diff --git a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp index cde03a3f4e09..58834a550be1 100644 --- a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp +++ b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp @@ -13,14 +13,14 @@ struct B : public A { // does not use runtime support. A *upcast(B *b) { return dynamic_cast<A *>(b); -// CHECK-LABEL: define %struct.A* @_Z6upcastP1B -// CHECK-NOT: call i8* @__dynamic_cast +// CHECK-LABEL: define {{.*}}%struct.A* @_Z6upcastP1B +// CHECK-NOT: call {{.*}}i8* @__dynamic_cast } // A NoOp dynamic_cast can be used with -fno-rtti iff it does not use // runtime support. B *samecast(B *b) { return dynamic_cast<B *>(b); -// CHECK-LABEL: define %struct.B* @_Z8samecastP1B -// CHECK-NOT: call i8* @__dynamic_cast +// CHECK-LABEL: define {{.*}}%struct.B* @_Z8samecastP1B +// CHECK-NOT: call {{.*}}i8* @__dynamic_cast } diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp index 7852644d2b74..e68738b9db58 100644 --- a/test/CodeGenCXX/extern-c.cpp +++ b/test/CodeGenCXX/extern-c.cpp @@ -71,5 +71,5 @@ namespace PR19411 { struct A { void f(); }; extern "C" void A::f() { void g(); g(); } // CHECK-LABEL: @_ZN7PR194111A1fEv( - // CHECK: call void @g() + // CHECK: call {{.*}}void @g() } diff --git a/test/CodeGenCXX/function-template-explicit-specialization.cpp b/test/CodeGenCXX/function-template-explicit-specialization.cpp index 8ff065569757..ed6cf84c2be5 100644 --- a/test/CodeGenCXX/function-template-explicit-specialization.cpp +++ b/test/CodeGenCXX/function-template-explicit-specialization.cpp @@ -3,11 +3,11 @@ template<typename T> void a(T); template<> void a(int) {} -// CHECK-LABEL: define void @_Z1aIiEvT_ +// CHECK-LABEL: define {{.*}}void @_Z1aIiEvT_ namespace X { template<typename T> void b(T); template<> void b(int) {} } -// CHECK-LABEL: define void @_ZN1X1bIiEEvT_ +// CHECK-LABEL: define {{.*}}void @_ZN1X1bIiEEvT_ diff --git a/test/CodeGenCXX/globalinit-loc.cpp b/test/CodeGenCXX/globalinit-loc.cpp index 813a890ae5b6..27120526fc30 100644 --- a/test/CodeGenCXX/globalinit-loc.cpp +++ b/test/CodeGenCXX/globalinit-loc.cpp @@ -4,7 +4,7 @@ // Verify that the global init helper function does not get associated // with any source location. // -// CHECK: define internal void @_GLOBAL__sub_I_globalinit_loc.cpp +// CHECK: define internal {{.*}}void @_GLOBAL__sub_I_globalinit_loc.cpp // CHECK: !dbg ![[DBG:.*]] // CHECK: !DISubprogram(linkageName: "_GLOBAL__sub_I_globalinit_loc.cpp" // CHECK-NOT: line: diff --git a/test/CodeGenCXX/inline-dllexport-member.cpp b/test/CodeGenCXX/inline-dllexport-member.cpp index af9a5360674a..4bc1d4ce633a 100644 --- a/test/CodeGenCXX/inline-dllexport-member.cpp +++ b/test/CodeGenCXX/inline-dllexport-member.cpp @@ -5,7 +5,7 @@ struct __declspec(dllexport) s { static const unsigned int ui = 0; }; -// CHECK: ![[SCOPE:[0-9]+]] = !DICompileUnit( +// CHECK: ![[SCOPE:[0-9]+]] = distinct !DICompileUnit( // CHECK: !DIGlobalVariable(name: "ui", linkageName: "_ZN1s2uiE", scope: ![[SCOPE]], // CHECK-SAME: variable: i32* @_ZN1s2uiE diff --git a/test/CodeGenCXX/linetable-virtual-variadic.cpp b/test/CodeGenCXX/linetable-virtual-variadic.cpp index c16c5e354b5c..115f1ae71408 100644 --- a/test/CodeGenCXX/linetable-virtual-variadic.cpp +++ b/test/CodeGenCXX/linetable-virtual-variadic.cpp @@ -17,7 +17,7 @@ void Derived::VariadicFunction(...) { } // // CHECK: !llvm.dbg.cu = !{![[CU:[0-9]+]]} // -// CHECK: ![[CU]] = !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] +// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] // CHECK: ![[SPs]] = !{![[SP:[0-9]+]]} // CHECK: ![[SP]] = !DISubprogram(name: "VariadicFunction",{{.*}} function: {{[^:]+}} @_ZN7Derived16VariadicFunctionEz // CHECK: ![[LOC]] = !DILocation({{.*}}scope: ![[SP]]) diff --git a/test/CodeGenCXX/mangle-address-space.cpp b/test/CodeGenCXX/mangle-address-space.cpp index a0b3c1aff224..f18480de83de 100644 --- a/test/CodeGenCXX/mangle-address-space.cpp +++ b/test/CodeGenCXX/mangle-address-space.cpp @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s -// CHECK-LABEL: define void @_Z2f0Pc +// CHECK-LABEL: define {{.*}}void @_Z2f0Pc void f0(char *p) { } -// CHECK-LABEL: define void @_Z2f0PU3AS1c +// CHECK-LABEL: define {{.*}}void @_Z2f0PU3AS1c void f0(char __attribute__((address_space(1))) *p) { } struct OpaqueType; typedef OpaqueType __attribute__((address_space(100))) * OpaqueTypePtr; -// CHECK-LABEL: define void @_Z2f0PU5AS10010OpaqueType +// CHECK-LABEL: define {{.*}}void @_Z2f0PU5AS10010OpaqueType void f0(OpaqueTypePtr) { } diff --git a/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp b/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp index e2cbe15dfa9f..b01d6099d8f7 100644 --- a/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp +++ b/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp @@ -3,22 +3,37 @@ template <typename T, int (T::*)() = nullptr> struct J {}; +template <typename T, int T::* = nullptr> +struct K {}; + struct __single_inheritance M; J<M> m; // CHECK-DAG: @"\01?m@@3U?$J@UM@@$0A@@@A" +K<M> m2; +// CHECK-DAG: @"\01?m2@@3U?$K@UM@@$0?0@@A" + struct __multiple_inheritance N; J<N> n; // CHECK-DAG: @"\01?n@@3U?$J@UN@@$HA@@@A" +K<N> n2; +// CHECK-DAG: @"\01?n2@@3U?$K@UN@@$0?0@@A" + struct __virtual_inheritance O; J<O> o; // CHECK-DAG: @"\01?o@@3U?$J@UO@@$IA@A@@@A" +K<O> o2; +// CHECK-DAG: @"\01?o2@@3U?$K@UO@@$FA@?0@@A" + struct P; J<P> p; // CHECK-DAG: @"\01?p@@3U?$J@UP@@$JA@A@?0@@A" +K<P> p2; +// CHECK-DAG: @"\01?p2@@3U?$K@UP@@$GA@A@?0@@A" + #pragma pointers_to_members(full_generality, virtual_inheritance) struct S { diff --git a/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp index 803cac3748b1..e710abe97e98 100644 --- a/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp +++ b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp @@ -69,8 +69,8 @@ void ReadFields() { // 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" +// CHECK: call {{.*}} @"\01??$ReadField@UV@@$0A@@@YAHAAUV@@@Z" +// CHECK: call {{.*}} @"\01??$ReadField@UU@@$0A@@@YAHAAUU@@@Z" // Non-polymorphic null data memptr vs first field memptr. MSVC mangles these // the same. @@ -141,3 +141,15 @@ void CallMethods() { // CHECK: call {{.*}} @"\01??$CallMethod@UM@@$0A@@@YAXAAUM@@@Z" // CHECK: call {{.*}} @"\01??$CallMethod@UV@@$0A@@@YAXAAUV@@@Z" // CHECK: call {{.*}} @"\01??$CallMethod@UU@@$0A@@@YAXAAUU@@@Z" + +namespace NegativeNVOffset { +struct A {}; +struct B : virtual A {}; +struct C : B { + virtual void f(); +}; +} + +template void CallMethod<NegativeNVOffset::C, &NegativeNVOffset::C::f>(NegativeNVOffset::C &); + +// CHECK-LABEL: define {{.*}} @"\01??$CallMethod@UC@NegativeNVOffset@@$I??_912@$BA@AEPPPPPPPM@A@@@YAXAAUC@NegativeNVOffset@@@Z" diff --git a/test/CodeGenCXX/mangle-nullptr-arg.cpp b/test/CodeGenCXX/mangle-nullptr-arg.cpp index 66ed7e5cfe34..e4ae3538c58e 100644 --- a/test/CodeGenCXX/mangle-nullptr-arg.cpp +++ b/test/CodeGenCXX/mangle-nullptr-arg.cpp @@ -2,15 +2,15 @@ template<int *ip> struct IP {}; -// CHECK-LABEL: define void @_Z5test12IPILPi0EE +// CHECK-LABEL: define {{.*}}void @_Z5test12IPILPi0EE void test1(IP<nullptr>) {} struct X{ }; template<int X::*pm> struct PM {}; -// CHECK-LABEL: define void @_Z5test22PMILM1Xi0EE +// CHECK-LABEL: define {{.*}}void @_Z5test22PMILM1Xi0EE void test2(PM<nullptr>) { } -// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLS0_0EE +// CHECK-LABEL: define {{.*}}void @_Z5test316DependentTypePtrIPiLS0_0EE template<typename T, T x> struct DependentTypePtr {}; void test3(DependentTypePtr<int*,nullptr>) { } diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp index aaae4b27f9a3..7fa300ae237b 100644 --- a/test/CodeGenCXX/mangle-template.cpp +++ b/test/CodeGenCXX/mangle-template.cpp @@ -98,7 +98,7 @@ namespace test8 { template<typename T> void f(int_c<meta<T>::type::value>) { } - // CHECK-LABEL: define weak_odr void @_ZN5test81fIiEEvNS_5int_cIXsr4metaIT_E4typeE5valueEEE( + // CHECK-LABEL: define weak_odr {{.*}}void @_ZN5test81fIiEEvNS_5int_cIXsr4metaIT_E4typeE5valueEEE( template void f<int>(int_c<sizeof(int)>); } @@ -157,13 +157,13 @@ namespace test12 { const int n = 10; template<typename T, T v> void test() {} void use() { - // CHECK-LABEL: define internal void @_ZN6test124testIFivEXadL_ZNS_L1fEvEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIFivEXadL_ZNS_L1fEvEEEEvv( test<int(), &f>(); - // CHECK-LABEL: define internal void @_ZN6test124testIRFivEL_ZNS_L1fEvEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIRFivEL_ZNS_L1fEvEEEvv( test<int(&)(), f>(); - // CHECK-LABEL: define internal void @_ZN6test124testIPKiXadL_ZNS_L1nEEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIPKiXadL_ZNS_L1nEEEEEvv( test<const int*, &n>(); - // CHECK-LABEL: define internal void @_ZN6test124testIRKiL_ZNS_L1nEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIRKiL_ZNS_L1nEEEEvv( test<const int&, n>(); } } diff --git a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp index 619b1b8a9489..62ead4fb69d3 100644 --- a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp +++ b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp @@ -58,4 +58,14 @@ void check_array_cookies_aligned() { // CHECK: getelementptr inbounds i8, i8* [[ARRAY_AS_CHAR]], i64 -8 } +namespace PR23990 { +struct S { + char x[42]; + void operator delete[](void *p, __SIZE_TYPE__); + // CHECK-LABEL: define void @"\01?delete_s@PR23990@@YAXPAUS@1@@Z"( + // CHECK: call void @"\01??_VS@PR23990@@SAXPAXI@Z"(i8* {{.*}}, i32 42) +}; +void delete_s(S *s) { delete[] s; } +} + // CHECK: attributes [[NUW]] = { nounwind{{.*}} } diff --git a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp index 8cb4a1f8bd24..a509d57194f2 100755 --- a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp +++ b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp @@ -541,9 +541,13 @@ void (D::*convertCToD(void (C::*mp)()))() { // // memptr.convert: ; preds = %entry // CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 0 -// CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 1 -// CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 2 -// CHECK: %[[adj:.*]] = add nsw i32 %{{.*}}, 4 +// CHECK: %[[nvoff:.*]] = extractvalue { i8*, i32, i32 } %{{.*}}, 1 +// CHECK: %[[vbidx:.*]] = extractvalue { i8*, i32, i32 } %{{.*}}, 2 +// CHECK: %[[is_nvbase:.*]] = icmp eq i32 %[[vbidx]], 0 +// CHECK: %[[nv_disp:.*]] = add nsw i32 %[[nvoff]], 4 +// CHECK: %[[nv_adj:.*]] = select i1 %[[is_nvbase]], i32 %[[nv_disp]], i32 0 +// CHECK: %[[dst_adj:.*]] = select i1 %[[is_nvbase]], i32 4, i32 0 +// CHECK: %[[adj:.*]] = sub nsw i32 %[[nv_adj]], %[[dst_adj]] // CHECK: insertvalue { i8*, i32, i32 } undef, i8* {{.*}}, 0 // CHECK: insertvalue { i8*, i32, i32 } {{.*}}, i32 %[[adj]], 1 // CHECK: insertvalue { i8*, i32, i32 } {{.*}}, i32 {{.*}}, 2 @@ -712,3 +716,16 @@ int foo(A *a, int A::*mp) { } #endif #endif + +namespace pr23878 { +struct A { virtual void g(); }; +struct B { virtual void f(); }; +struct C : virtual B { void f(); }; +struct D : A, C {}; + +typedef void (D::*DMemPtrTy)(); + +// CHECK-LABEL: define void @"\01?get_memptr@pr23878@@YAP8D@1@AEXXZXZ" +// CHECK: @"\01??_9C@pr23878@@$BA@AE" to i8*), i32 0, i32 4 +DMemPtrTy get_memptr() { return &D::f; } +} diff --git a/test/CodeGenCXX/microsoft-abi-thunks.cpp b/test/CodeGenCXX/microsoft-abi-thunks.cpp index 8cbea5c4deeb..823033461612 100644 --- a/test/CodeGenCXX/microsoft-abi-thunks.cpp +++ b/test/CodeGenCXX/microsoft-abi-thunks.cpp @@ -91,7 +91,7 @@ struct E : D { E::E() {} // Emits vftable and forces thunk generation. -// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.C* @"\01?goo@E@@QAEPAUB@@XZ" +// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.C* @"\01?goo@E@@QAEPAUB@@XZ"{{.*}} comdat // CODEGEN: call x86_thiscallcc %struct.C* @"\01?goo@E@@UAEPAUC@@XZ" // CODEGEN: getelementptr inbounds i8, i8* {{.*}}, i32 4 // CODEGEN: ret @@ -124,7 +124,7 @@ struct I : D { I::I() {} // Emits vftable and forces thunk generation. -// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.{{[BF]}}* @"\01?goo@I@@QAEPAUB@@XZ" +// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.{{[BF]}}* @"\01?goo@I@@QAEPAUB@@XZ"{{.*}} comdat // CODEGEN: %[[ORIG_RET:.*]] = call x86_thiscallcc %struct.F* @"\01?goo@I@@UAEPAUF@@XZ" // CODEGEN: %[[ORIG_RET_i8:.*]] = bitcast %struct.F* %[[ORIG_RET]] to i8* // CODEGEN: %[[VBPTR_i8:.*]] = getelementptr inbounds i8, i8* %[[ORIG_RET_i8]], i32 4 diff --git a/test/CodeGenCXX/pr11797.cpp b/test/CodeGenCXX/pr11797.cpp index 2a31090e4218..3767b1d62d14 100644 --- a/test/CodeGenCXX/pr11797.cpp +++ b/test/CodeGenCXX/pr11797.cpp @@ -5,4 +5,4 @@ namespace std __attribute__ ((__visibility__ ("default"))) {} void foo() { } #pragma GCC visibility pop -// CHECK-LABEL: define void @_Z3foov() +// CHECK-LABEL: define {{.*}}void @_Z3foov() diff --git a/test/CodeGenCXX/pr18661.cpp b/test/CodeGenCXX/pr18661.cpp index 235867831e28..65ffd6f910c6 100644 --- a/test/CodeGenCXX/pr18661.cpp +++ b/test/CodeGenCXX/pr18661.cpp @@ -11,4 +11,4 @@ extern "C" { // 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() +// CHECK: define {{.*}}void @f() diff --git a/test/CodeGenCXX/pr9965.cpp b/test/CodeGenCXX/pr9965.cpp index 46fd60914b0e..95ba2beb87fc 100644 --- a/test/CodeGenCXX/pr9965.cpp +++ b/test/CodeGenCXX/pr9965.cpp @@ -8,7 +8,7 @@ struct X : A // default constructor is not trivial }; X<int> x; -// CHECK-LABEL: define internal void @__cxx_global_var_init() +// CHECK-LABEL: define internal {{.*}}void @__cxx_global_var_init() // CHECK: call {{.*}} @_ZN1XIiEC1Ev // CHECK: define linkonce_odr {{.*}} @_ZN1XIiEC1Ev // CHECK: define linkonce_odr {{.*}} @_ZN1XIiEC2Ev diff --git a/test/CodeGenCXX/pragma-weak.cpp b/test/CodeGenCXX/pragma-weak.cpp index e2d464818edb..caab2662a9f5 100644 --- a/test/CodeGenCXX/pragma-weak.cpp +++ b/test/CodeGenCXX/pragma-weak.cpp @@ -14,18 +14,18 @@ void S::foo() {} #pragma weak zed namespace bar { void zed() {} } -// CHECK-LABEL: define void @_ZN3bar3zedEv( +// CHECK-LABEL: define {{.*}}void @_ZN3bar3zedEv( #pragma weak bah void bah() {} -// CHECK-LABEL: define void @_Z3bahv( +// CHECK-LABEL: define {{.*}}void @_Z3bahv( #pragma weak baz extern "C" void baz() {} -// CHECK-LABEL: define weak void @baz( +// CHECK-LABEL: define weak {{.*}}void @baz( #pragma weak _Z3baxv void bax() {} // GCC produces a weak symbol for this one, but it doesn't look like a good // idea to expose the mangling to the pragma unless we really have to. -// CHECK-LABEL: define void @_Z3baxv( +// CHECK-LABEL: define {{.*}}void @_Z3baxv( diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp index 4c0a8861b996..21cceddf19e6 100644 --- a/test/CodeGenCXX/predefined-expr.cpp +++ b/test/CodeGenCXX/predefined-expr.cpp @@ -559,11 +559,11 @@ XXX::XXX() _dispatch_once(^{ notify_register_dispatch( ^(int token) { XXLog(__FUNCTION__); }); }); } -// CHECK: define internal void @___ZN3XXXC2Ev_block_invoke_ +// CHECK: define internal {{.*}}void @___ZN3XXXC2Ev_block_invoke_ XXX::~XXX() { _dispatch_once(^{ notify_register_dispatch( ^(int token) { XXLog(__FUNCTION__); }); }); } -// CHECK: define internal void @___ZN3XXXD2Ev_block_invoke_ +// CHECK: define internal {{.*}}void @___ZN3XXXD2Ev_block_invoke_ diff --git a/test/CodeGenCXX/redefine_extname.cpp b/test/CodeGenCXX/redefine_extname.cpp index 2b6b703a1b8f..f76fe6252fef 100644 --- a/test/CodeGenCXX/redefine_extname.cpp +++ b/test/CodeGenCXX/redefine_extname.cpp @@ -8,7 +8,7 @@ extern "C" { int statvfs64(struct statvfs64 *); } -void foo() { +void some_func() { struct statvfs64 st; statvfs64(&st); // Check that even if there is a structure with redefined name before the @@ -16,3 +16,15 @@ void foo() { // CHECK: call i32 @statvfs(%struct.statvfs64* %st) } +// This is a case when redefenition is deferred *and* we have a local of the +// same name. PR23923. +#pragma redefine_extname foo bar +int f() { + int foo = 0; + return foo; +} +extern "C" { + int foo() { return 1; } +// CHECK: define i32 @bar() +} + diff --git a/test/CodeGenCXX/template-dependent-bind-temporary.cpp b/test/CodeGenCXX/template-dependent-bind-temporary.cpp index 47d8279a4774..4c4b3ea9f776 100644 --- a/test/CodeGenCXX/template-dependent-bind-temporary.cpp +++ b/test/CodeGenCXX/template-dependent-bind-temporary.cpp @@ -18,7 +18,7 @@ void IntToString(T a) } int main() { -// CHECK-LABEL: define linkonce_odr void @_Z11IntToStringIcEvT_( +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z11IntToStringIcEvT_( IntToString('a'); } diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp index 2287d65a286d..0e97255cc6fa 100644 --- a/test/CodeGenCXX/thunks.cpp +++ b/test/CodeGenCXX/thunks.cpp @@ -365,6 +365,7 @@ namespace Test15 { // This is from Test5: // CHECK-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv( +// CHECK-NOT: comdat // CHECK-LABEL: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv // This is from Test10: diff --git a/test/CodeGenCXX/trap-fnattr.cpp b/test/CodeGenCXX/trap-fnattr.cpp new file mode 100644 index 000000000000..b73ea432b787 --- /dev/null +++ b/test/CodeGenCXX/trap-fnattr.cpp @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC +// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION + +// TRAPFUNC-LABEL: define void @{{_Z12test_builtinv|\"\\01\?test_builtin@@YAXXZ\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR0:#[0-9]+]] + +// NOOPTION-LABEL: define void @{{_Z12test_builtinv|\"\\01\?test_builtin@@YAXXZ\"}} +// NOOPTION: call void @llvm.trap(){{$}} + +void test_builtin(void) { + __builtin_trap(); +} + +// TRAPFUNC-LABEL: define {{.*}}i32 @{{_Z13test_noreturnv|\"\\01\?test_noreturn@@YAHXZ\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR0]] + +// NOOPTION-LABEL: define {{.*}}i32 @{{_Z13test_noreturnv|\"\\01\?test_noreturn@@YAHXZ\"}} +// NOOPTION: call void @llvm.trap(){{$}} + +int test_noreturn(void) { +} + +// TRAPFUNC-LABEL: define {{.*}}i32 @{{_Z17test_add_overflowii|\"\\01\?test_add_overflow@@YAHHH@Z\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR1:#[0-9]+]] + +// NOOPTION-LABEL: define {{.*}}i32 @{{_Z17test_add_overflowii|\"\\01\?test_add_overflow@@YAHHH@Z\"}} +// NOOPTION: call void @llvm.trap() [[ATTR2:#[0-9]+]] + +int test_add_overflow(int a, int b) { + return a + b; +} + +// TRAPFUNC: attributes [[ATTR0]] = { {{.*}}"trap-func-name"="mytrap" } +// TRAPFUNC: attributes [[ATTR1]] = { {{.*}}"trap-func-name"="mytrap" } + +// NOOPTION-NOT: attributes [[ATTR2]] = { {{.*}}"trap-func-name"="mytrap" } diff --git a/test/CodeGenCXX/typeid-should-throw.cpp b/test/CodeGenCXX/typeid-should-throw.cpp index 1d8fc85896af..428c737a3a08 100644 --- a/test/CodeGenCXX/typeid-should-throw.cpp +++ b/test/CodeGenCXX/typeid-should-throw.cpp @@ -10,73 +10,73 @@ struct A { struct B : A {}; void f1(A *x) { typeid(false, *x); } -// CHECK-LABEL: define void @_Z2f1P1A +// CHECK-LABEL: define {{.*}}void @_Z2f1P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f2(bool b, A *x, A *y) { typeid(b ? *x : *y); } -// CHECK-LABEL: define void @_Z2f2bP1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z2f2bP1AS0_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f3(bool b, A *x, A &y) { typeid(b ? *x : y); } -// CHECK-LABEL: define void @_Z2f3bP1ARS_ +// CHECK-LABEL: define {{.*}}void @_Z2f3bP1ARS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f4(bool b, A &x, A *y) { typeid(b ? x : *y); } -// CHECK-LABEL: define void @_Z2f4bR1APS_ +// CHECK-LABEL: define {{.*}}void @_Z2f4bR1APS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f5(volatile A *x) { typeid(*x); } -// CHECK-LABEL: define void @_Z2f5PV1A +// CHECK-LABEL: define {{.*}}void @_Z2f5PV1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f6(A *x) { typeid((B &)*(B *)x); } -// CHECK-LABEL: define void @_Z2f6P1A +// CHECK-LABEL: define {{.*}}void @_Z2f6P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f7(A *x) { typeid((*x)); } -// CHECK-LABEL: define void @_Z2f7P1A +// CHECK-LABEL: define {{.*}}void @_Z2f7P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f8(A *x) { typeid(x[0]); } -// CHECK-LABEL: define void @_Z2f8P1A +// CHECK-LABEL: define {{.*}}void @_Z2f8P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f9(A *x) { typeid(0[x]); } -// CHECK-LABEL: define void @_Z2f9P1A +// CHECK-LABEL: define {{.*}}void @_Z2f9P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f10(A *x, A *y) { typeid(*y ?: *x); } -// CHECK-LABEL: define void @_Z3f10P1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z3f10P1AS0_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f11(A *x, A &y) { typeid(*x ?: y); } -// CHECK-LABEL: define void @_Z3f11P1ARS_ +// CHECK-LABEL: define {{.*}}void @_Z3f11P1ARS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f12(A &x, A *y) { typeid(x ?: *y); } -// CHECK-LABEL: define void @_Z3f12R1APS_ +// CHECK-LABEL: define {{.*}}void @_Z3f12R1APS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f13(A &x, A &y) { typeid(x ?: y); } -// CHECK-LABEL: define void @_Z3f13R1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z3f13R1AS0_ // CHECK-NOT: icmp eq {{.*}}, null void f14(A *x) { typeid((const A &)(A)*x); } -// CHECK-LABEL: define void @_Z3f14P1A +// CHECK-LABEL: define {{.*}}void @_Z3f14P1A // CHECK-NOT: icmp eq {{.*}}, null void f15(A *x) { typeid((A &&)*(A *)nullptr); } -// CHECK-LABEL: define void @_Z3f15P1A +// CHECK-LABEL: define {{.*}}void @_Z3f15P1A // CHECK-NOT: icmp eq {{.*}}, null diff --git a/test/CodeGenCXX/vararg-non-pod.cpp b/test/CodeGenCXX/vararg-non-pod.cpp index 613b28c736f0..36891a4d28c8 100644 --- a/test/CodeGenCXX/vararg-non-pod.cpp +++ b/test/CodeGenCXX/vararg-non-pod.cpp @@ -8,7 +8,7 @@ struct X { void vararg(...); -// CHECK-LABEL: define void @_Z4test1X +// CHECK-LABEL: define {{.*}}void @_Z4test1X void test(X x) { // CHECK: call void @llvm.trap() vararg(x); diff --git a/test/CodeGenCXX/virtual-destructor-synthesis.cpp b/test/CodeGenCXX/virtual-destructor-synthesis.cpp index 80d1b1e4ec75..59272358d145 100644 --- a/test/CodeGenCXX/virtual-destructor-synthesis.cpp +++ b/test/CodeGenCXX/virtual-destructor-synthesis.cpp @@ -12,5 +12,5 @@ pile_box::pile_box(box *pp) { } -// CHECK: call void @_ZdlPv +// CHECK: call {{.*}}void @_ZdlPv diff --git a/test/CodeGenCXX/vla-lambda-capturing.cpp b/test/CodeGenCXX/vla-lambda-capturing.cpp index f2332bf0dc99..44b6a2506d14 100644 --- a/test/CodeGenCXX/vla-lambda-capturing.cpp +++ b/test/CodeGenCXX/vla-lambda-capturing.cpp @@ -12,7 +12,7 @@ typedef __INTPTR_TYPE__ intptr_t; // CHECK-DAG: [[CAP_TYPE3:%.+]] = type { [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]], [[INTPTR_T]]*, [[INTPTR_T]]* } // CHECK-DAG: [[CAP_TYPE4:%.+]] = type { [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]]* } -// CHECK: define void [[G:@.+]]( +// CHECK: define {{.*}}void [[G:@.+]]( // CHECK: [[N_ADDR:%.+]] = alloca [[INTPTR_T]] // CHECK: store [[INTPTR_T]] %{{.+}}, [[INTPTR_T]]* [[N_ADDR]] // CHECK: [[N_VAL:%.+]] = load [[INTPTR_T]], [[INTPTR_T]]* [[N_ADDR]] @@ -22,7 +22,7 @@ typedef __INTPTR_TYPE__ intptr_t; // CHECK: store [[INTPTR_T]]* %{{.+}}, [[INTPTR_T]]** [[CAP_BUFFER_ADDR]] // CHECK: [[CAP_N_REF:%.+]] = getelementptr inbounds [[CAP_TYPE1]], [[CAP_TYPE1]]* [[CAP_ARG:%.+]], i{{.+}} 0, i{{.+}} 2 // CHECK: store [[INTPTR_T]]* [[N_ADDR]], [[INTPTR_T]]** [[CAP_N_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[G_LAMBDA:@.+]]([[CAP_TYPE1]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[G_LAMBDA:@.+]]([[CAP_TYPE1]]* [[CAP_ARG]]) // CHECK: ret void void g(intptr_t n) { intptr_t buffer[n]; @@ -70,17 +70,17 @@ void b(intptr_t n, T arg) { // CHECK-LABEL: @main int main() { - // CHECK: call void [[G]]([[INTPTR_T]] [[INTPTR_T_ATTR:(signext )?]]1) + // CHECK: call {{.*}}void [[G]]([[INTPTR_T]] [[INTPTR_T_ATTR:(signext )?]]1) g((intptr_t)1); - // CHECK: call void [[F_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]1, [[INTPTR_T]] [[INTPTR_T_ATTR]]2) + // CHECK: call {{.*}}void [[F_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]1, [[INTPTR_T]] [[INTPTR_T_ATTR]]2) f((intptr_t)1, (intptr_t)2); - // CHECK: call void [[B_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]12, [[INTPTR_T]] [[INTPTR_T_ATTR]]13) + // CHECK: call {{.*}}void [[B_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]12, [[INTPTR_T]] [[INTPTR_T_ATTR]]13) b((intptr_t)12, (intptr_t)13); // CHECK: ret i32 0 return 0; } -// CHECK: define linkonce_odr void [[F_INT]]([[INTPTR_T]] +// CHECK: define linkonce_odr {{.*}}void [[F_INT]]([[INTPTR_T]] // CHECK: [[SIZE:%.+]] = add // CHECK: call i{{.+}}* @llvm.stacksave() // CHECK: [[BUFFER_ADDR:%.+]] = alloca [[INTPTR_T]], [[INTPTR_T]] [[SIZE]] @@ -88,11 +88,11 @@ int main() { // CHECK: store [[INTPTR_T]] [[SIZE]], [[INTPTR_T]]* [[CAP_SIZE_REF]] // CHECK: [[CAP_BUFFER_ADDR_REF:%.+]] = getelementptr inbounds [[CAP_TYPE2]], [[CAP_TYPE2]]* [[CAP_ARG]], i{{.+}} 0, i{{.+}} 1 // CHECK: store [[INTPTR_T]]* [[BUFFER_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[F_INT_LAMBDA:@.+]]([[CAP_TYPE2]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[F_INT_LAMBDA:@.+]]([[CAP_TYPE2]]* [[CAP_ARG]]) // CHECK: call void @llvm.stackrestore( // CHECK: ret void // CHECK: void [[B_INT]]([[INTPTR_T]] -// CHECK: [[SIZE1:%.+]] = call [[INTPTR_T]] +// CHECK: [[SIZE1:%.+]] = call {{.*}}[[INTPTR_T]] // CHECK: call i{{.+}}* @llvm.stacksave() // CHECK: [[BUFFER2_ADDR:%.+]] = alloca [[INTPTR_T]], [[INTPTR_T]] [[SIZE1]] // CHECK: [[SIZE2:%.+]] = add @@ -107,11 +107,11 @@ int main() { // CHECK: store [[INTPTR_T]]* [[BUFFER1_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER1_ADDR_REF]] // CHECK: [[CAP_BUFFER2_ADDR_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[CAP_ARG]], i{{.+}} 0, i{{.+}} 4 // CHECK: store [[INTPTR_T]]* [[BUFFER2_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER2_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA:@.+]]([[CAP_TYPE3]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[B_INT_LAMBDA:@.+]]([[CAP_TYPE3]]* [[CAP_ARG]]) // CHECK: call void @llvm.stackrestore( // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[F_INT_LAMBDA]]([[CAP_TYPE2]]* +// CHECK: define linkonce_odr{{.*}} void [[F_INT_LAMBDA]]([[CAP_TYPE2]]* // CHECK: [[THIS:%.+]] = load [[CAP_TYPE2]]*, [[CAP_TYPE2]]** // CHECK: [[SIZE_REF:%.+]] = getelementptr inbounds [[CAP_TYPE2]], [[CAP_TYPE2]]* [[THIS]], i{{.+}} 0, i{{.+}} 0 // CHECK: [[SIZE:%.+]] = load [[INTPTR_T]], [[INTPTR_T]]* [[SIZE_REF]] @@ -120,7 +120,7 @@ int main() { // CHECK: call void @llvm.stackrestore( // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA]]([[CAP_TYPE3]]* +// CHECK: define linkonce_odr{{.*}} void [[B_INT_LAMBDA]]([[CAP_TYPE3]]* // CHECK: [[SIZE2_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 // CHECK: [[SIZE2:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIZE2_REF]] // CHECK: [[SIZE1_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 2 @@ -152,10 +152,10 @@ int main() { // CHECK: [[BUFFER1_ADDR_REF_ORIG:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 3 // CHECK: [[BUFFER1_ADDR_ORIG:%.+]] = load [[INTPTR_T]]*, [[INTPTR_T]]** [[BUFFER1_ADDR_REF_ORIG]] // CHECK: store [[INTPTR_T]]* [[BUFFER1_ADDR_ORIG]], [[INTPTR_T]]** [[BUFFER1_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA_LAMBDA:@.+]]([[CAP_TYPE4]]* [[CAP]]) +// CHECK: call{{.*}} void [[B_INT_LAMBDA_LAMBDA:@.+]]([[CAP_TYPE4]]* [[CAP]]) // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA_LAMBDA]]([[CAP_TYPE4]]* +// CHECK: define linkonce_odr{{.*}} void [[B_INT_LAMBDA_LAMBDA]]([[CAP_TYPE4]]* // CHECK: [[SIZE1_REF:%.+]] = getelementptr inbounds [[CAP_TYPE4]], [[CAP_TYPE4]]* [[THIS:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 // CHECK: [[SIZE1:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIZE1_REF]] // CHECK: [[SIZE2_REF:%.+]] = getelementptr inbounds [[CAP_TYPE4]], [[CAP_TYPE4]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 3 diff --git a/test/CodeGenCXX/volatile-1.cpp b/test/CodeGenCXX/volatile-1.cpp index 65eb9f69ebd9..f32e4288b897 100644 --- a/test/CodeGenCXX/volatile-1.cpp +++ b/test/CodeGenCXX/volatile-1.cpp @@ -17,7 +17,7 @@ volatile struct S { int printf(const char *, ...); -// CHECK: define void @{{.*}}test +// CHECK: define {{.*}}void @{{.*}}test void test() { asm("nop"); // CHECK: call void asm diff --git a/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp b/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp index bb9bd888b20f..3392b32bd2b6 100644 --- a/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp +++ b/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-nacl -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnux32 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-nacl -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnux32 -emit-llvm -o - %s | FileCheck %s struct test_struct {}; typedef int test_struct::* test_struct_mdp; @@ -42,3 +42,16 @@ struct struct_with_mfp_too_much { void f_struct_with_mfp_too_much(struct_with_mfp_too_much a, int x) { (void)a; } + +/* Struct containing an empty struct */ +typedef struct { int* a; test_struct x; double *b; } struct_with_empty; + +// CHECK-LABEL: define void @{{.*}}f_pass_struct_with_empty{{.*}}(i64 %x{{.*}}, double* %x +void f_pass_struct_with_empty(struct_with_empty x) { + (void) x; +} + +// CHECK-LABEL: define { i64, double* } @{{.*}}f_return_struct_with_empty +struct_with_empty f_return_struct_with_empty() { + return {0, {}, 0}; +} |