2017-01-10 01:25:30 +08:00
|
|
|
// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++14 \
|
|
|
|
// RUN: -fno-threadsafe-statics -fms-extensions -O1 -mconstructor-aliases \
|
|
|
|
// RUN: -disable-llvm-passes -o - %s -w -fms-compatibility-version=19.00 | \
|
|
|
|
// RUN: FileCheck %s
|
|
|
|
|
|
|
|
struct CtorWithClosure {
|
|
|
|
__declspec(dllexport) CtorWithClosure(...) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
2017-01-10 01:25:30 +08:00
|
|
|
// CHECK: %[[this_addr:.*]] = alloca %struct.CtorWithClosure*, align 4
|
|
|
|
// CHECK: store %struct.CtorWithClosure* %this, %struct.CtorWithClosure** %[[this_addr]], align 4
|
|
|
|
// CHECK: %[[this:.*]] = load %struct.CtorWithClosure*, %struct.CtorWithClosure** %[[this_addr]]
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call %struct.CtorWithClosure* (%struct.CtorWithClosure*, ...) @"??0CtorWithClosure@@QAA@ZZ"(%struct.CtorWithClosure* %[[this]])
|
2017-01-10 01:25:30 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CtorWithClosureOutOfLine {
|
|
|
|
__declspec(dllexport) CtorWithClosureOutOfLine(...);
|
|
|
|
};
|
|
|
|
CtorWithClosureOutOfLine::CtorWithClosureOutOfLine(...) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorWithClosureOutOfLine@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
2017-01-10 01:25:30 +08:00
|
|
|
|
|
|
|
#define DELETE_IMPLICIT_MEMBERS(ClassName) \
|
|
|
|
ClassName(ClassName &&) = delete; \
|
|
|
|
ClassName(ClassName &) = delete; \
|
|
|
|
~ClassName() = delete; \
|
|
|
|
ClassName &operator=(ClassName &) = delete
|
|
|
|
|
|
|
|
struct __declspec(dllexport) ClassWithClosure {
|
|
|
|
DELETE_IMPLICIT_MEMBERS(ClassWithClosure);
|
|
|
|
ClassWithClosure(...) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FClassWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
2017-01-10 01:25:30 +08:00
|
|
|
// CHECK: %[[this_addr:.*]] = alloca %struct.ClassWithClosure*, align 4
|
|
|
|
// CHECK: store %struct.ClassWithClosure* %this, %struct.ClassWithClosure** %[[this_addr]], align 4
|
|
|
|
// CHECK: %[[this:.*]] = load %struct.ClassWithClosure*, %struct.ClassWithClosure** %[[this_addr]]
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call %struct.ClassWithClosure* (%struct.ClassWithClosure*, ...) @"??0ClassWithClosure@@QAA@ZZ"(%struct.ClassWithClosure* %[[this]])
|
2017-01-10 01:25:30 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T> struct TemplateWithClosure {
|
|
|
|
TemplateWithClosure(int x = sizeof(T)) {}
|
|
|
|
};
|
|
|
|
extern template struct TemplateWithClosure<char>;
|
|
|
|
template struct __declspec(dllexport) TemplateWithClosure<char>;
|
|
|
|
extern template struct TemplateWithClosure<int>;
|
|
|
|
template struct __declspec(dllexport) TemplateWithClosure<int>;
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_F?$TemplateWithClosure@D@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
|
|
|
// CHECK: call {{.*}} @"??0?$TemplateWithClosure@D@@QAE@H@Z"({{.*}}, i32 1)
|
2017-01-10 01:25:30 +08:00
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_F?$TemplateWithClosure@H@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
|
|
|
// CHECK: call {{.*}} @"??0?$TemplateWithClosure@H@@QAE@H@Z"({{.*}}, i32 4)
|
2017-01-10 01:25:30 +08:00
|
|
|
|
|
|
|
struct __declspec(dllexport) NestedOuter {
|
|
|
|
DELETE_IMPLICIT_MEMBERS(NestedOuter);
|
|
|
|
NestedOuter(void *p = 0) {}
|
|
|
|
struct __declspec(dllexport) NestedInner {
|
|
|
|
DELETE_IMPLICIT_MEMBERS(NestedInner);
|
|
|
|
NestedInner(void *p = 0) {}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FNestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FNestedInner@NestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
|
2017-01-10 01:27:17 +08:00
|
|
|
|
|
|
|
struct HasDtor {
|
|
|
|
~HasDtor();
|
|
|
|
int o;
|
|
|
|
};
|
|
|
|
struct HasImplicitDtor1 { HasDtor o; };
|
|
|
|
struct HasImplicitDtor2 { HasDtor o; };
|
|
|
|
struct __declspec(dllexport) CtorClosureInline {
|
|
|
|
CtorClosureInline(const HasImplicitDtor1 &v = {}) {}
|
|
|
|
};
|
|
|
|
struct __declspec(dllexport) CtorClosureOutOfLine {
|
|
|
|
CtorClosureOutOfLine(const HasImplicitDtor2 &v = {});
|
|
|
|
};
|
|
|
|
CtorClosureOutOfLine::CtorClosureOutOfLine(const HasImplicitDtor2 &v) {}
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorClosureInline@@QAEXXZ"
|
|
|
|
// CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"??1HasImplicitDtor1@@QAE@XZ"
|
|
|
|
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorClosureOutOfLine@@QAEXXZ"
|
|
|
|
// CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"??1HasImplicitDtor2@@QAE@XZ"
|