diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/CodeGenCXX/dllexport.cpp | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'test/CodeGenCXX/dllexport.cpp')
-rw-r--r-- | test/CodeGenCXX/dllexport.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index c598880..1412ad8 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -544,6 +544,7 @@ struct A { struct __declspec(dllexport) B { B(A = 0) {} }; + } // // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ"({{.*}}) comdat @@ -582,7 +583,7 @@ void W::foo() {} // M32-DAG: define weak_odr dllexport x86_thiscallcc %struct.W* @"\01??0W@@QAE@ABU0@@Z" // vftable: // M32-DAG: [[W_VTABLE:@.*]] = private unnamed_addr constant [2 x i8*] [i8* bitcast (%rtti.CompleteObjectLocator* @"\01??_R4W@@6B@" to i8*), i8* bitcast (void (%struct.W*)* @"\01?foo@W@@UAEXXZ" to i8*)], comdat($"\01??_7W@@6B@") -// M32-DAG: @"\01??_7W@@6B@" = dllexport unnamed_addr alias getelementptr inbounds ([2 x i8*], [2 x i8*]* [[W_VTABLE]], i32 0, i32 1) +// M32-DAG: @"\01??_7W@@6B@" = dllexport unnamed_addr alias i8*, getelementptr inbounds ([2 x i8*], [2 x i8*]* [[W_VTABLE]], i32 0, i32 1) // G32-DAG: @_ZTV1W = dllexport unnamed_addr constant [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1W to i8*), i8* bitcast (void (%struct.W*)* @_ZN1W3fooEv to i8*)] struct __declspec(dllexport) X : public virtual W {}; @@ -611,7 +612,6 @@ namespace UseDtorAlias { B::~B() { } // Emit a alias definition of B's constructor. // M32-DAG: @"\01??1B@UseDtorAlias@@QAE@XZ" = dllexport alias {{.*}} @"\01??1A@UseDtorAlias@@QAE@XZ" - } struct __declspec(dllexport) DefaultedCtorsDtors { @@ -729,6 +729,54 @@ extern template struct PR23770DerivedTemplate<int>; template struct __declspec(dllexport) PR23770DerivedTemplate<int>; // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$PR23770BaseTemplate@H@@QAEXXZ" +namespace InClassInits { + +struct __declspec(dllexport) S { + int x = 42; +}; +// M32-DAG: define weak_odr dllexport x86_thiscallcc %"struct.InClassInits::S"* @"\01??0S@InClassInits@@QAE@XZ" + +// dllexport an already instantiated class template. +template <typename T> struct Base { + int x = 42; +}; +Base<int> base; +struct __declspec(dllexport) T : Base<int> { }; +// M32-DAG: define weak_odr dllexport x86_thiscallcc %"struct.InClassInits::Base"* @"\01??0?$Base@H@InClassInits@@QAE@XZ" + +struct A { A(int); }; +struct __declspec(dllexport) U { + // Class with both default constructor closure and in-class initializer. + U(A = 0) {} + int x = 0; +}; +// M32-DAG: define weak_odr dllexport x86_thiscallcc %"struct.InClassInits::U"* @"\01??0U@InClassInits@@QAE@UA@1@@Z" + +struct Evil { + template <typename T> struct Base { + int x = 0; + }; + struct S : Base<int> {}; + // The already instantiated Base<int> becomes dllexported below, but the + // in-class initializer for Base<>::x still hasn't been parsed, so emitting + // the default ctor must still be delayed. + struct __declspec(dllexport) T : Base<int> {}; +}; +// M32-DAG: define weak_odr dllexport x86_thiscallcc %"struct.InClassInits::Evil::Base"* @"\01??0?$Base@H@Evil@InClassInits@@QAE@XZ" + +template <typename T> struct Foo {}; +template <typename T> struct Bar { + Bar<T> &operator=(Foo<T>) {} +}; +struct __declspec(dllexport) Baz { + Bar<int> n; +}; +// After parsing Baz, in ActOnFinishCXXNonNestedClass we would synthesize +// Baz's operator=, causing instantiation of Foo<int> after which +// ActOnFinishCXXNonNestedClass is called, and we would bite our own tail. +// M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable(1) %"struct.InClassInits::Baz"* @"\01??4Baz@InClassInits@@QAEAAU01@ABU01@@Z" +} + //===----------------------------------------------------------------------===// // Classes with template base classes |