22// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -DMSABI -w | FileCheck --check-prefix=MSC --check-prefix=M64 %s
33// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU --check-prefix=G32 %s
44// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU %s
5+ // RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU --check-prefix=C32 %s
6+ // RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU %s
57// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -fms-compatibility-version=18.00 -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -DMSABI -w | FileCheck --check-prefix=MO1 --check-prefix=M18 %s
68// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -DMSABI -w | FileCheck --check-prefix=MO1 --check-prefix=M19 %s
79// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -w | FileCheck --check-prefix=GO1 %s
8- // RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-scei-ps4 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
9- // RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-sie-ps5 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
10+ // RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-scei-ps4 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
11+ // RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-sie-ps5 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
1012
1113// CHECK-NOT doesn't play nice with CHECK-DAG, so use separate run lines.
1214// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -DMSABI -w | FileCheck --check-prefix=MSC2 %s
1315// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU2 %s
16+ // RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU2 %s
1417
1518// Helper structs to make templates more expressive.
1619struct ImplicitInst_Imported {};
@@ -205,7 +208,7 @@ USEVAR(VarTmpl<ExplicitSpec_Imported>)
205208// Functions
206209// ===----------------------------------------------------------------------===//
207210
208- // GNU-DAG: declare dso_local void @_ZdlPv{{j|y }}(ptr, i{{32|64}})
211+ // GNU-DAG: declare dso_local void @_ZdlPv{{[jym] }}(ptr, i{{32|64}})
209212
210213// Import function declaration.
211214// MSC-DAG: declare dllimport void @"?decl@@YAXXZ"()
@@ -311,7 +314,7 @@ USE(friend5)
311314
312315// Implicit declarations can be redeclared with dllimport.
313316// MSC-DAG: declare dllimport nonnull ptr @"??2@{{YAPAXI|YAPEAX_K}}@Z"(
314- // GNU-DAG: declare dllimport nonnull ptr @_Znw{{[yj ]}}(
317+ // GNU-DAG: declare dllimport nonnull ptr @_Znw{{[yjm ]}}(
315318__declspec(dllimport) void* operator new(__SIZE_TYPE__ n);
316319void UNIQ (use)() { ::operator new (42 ); }
317320
@@ -677,6 +680,7 @@ struct __declspec(dllimport) KeyFuncClass {
677680};
678681extern constexpr KeyFuncClass keyFuncClassVar = {};
679682// G32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
683+ // C32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
680684
681685struct __declspec (dllimport) X : public virtual W {};
682686USECLASS (X)
@@ -813,20 +817,23 @@ template <typename T> struct __declspec(dllimport) PartiallySpecializedClassTemp
813817USEMEMFUNC (PartiallySpecializedClassTemplate<void *>, f);
814818// M32-DAG: declare dso_local x86_thiscallcc void @"?f@?$PartiallySpecializedClassTemplate@PAX@@QAEXXZ"
815819// G32-DAG: declare dllimport x86_thiscallcc void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
820+ // C32-DAG: declare dllimport void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
816821
817822// Attributes on explicit specializations are honored.
818823template <typename T> struct ExplicitlySpecializedClassTemplate {};
819824template <> struct __declspec (dllimport) ExplicitlySpecializedClassTemplate<void *> { void f (); };
820825USEMEMFUNC (ExplicitlySpecializedClassTemplate<void *>, f);
821826// M32-DAG: declare dllimport x86_thiscallcc void @"?f@?$ExplicitlySpecializedClassTemplate@PAX@@QAEXXZ"
822827// G32-DAG: declare dllimport x86_thiscallcc void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
828+ // C32-DAG: declare dllimport void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
823829
824830// MS inherits DLL attributes to partial specializations.
825831template <typename T> struct __declspec (dllimport) PartiallySpecializedImportedClassTemplate {};
826832template <typename T> struct PartiallySpecializedImportedClassTemplate <T*> { void f () {} };
827833USEMEMFUNC (PartiallySpecializedImportedClassTemplate<void *>, f);
828834// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$PartiallySpecializedImportedClassTemplate@PAX@@QAEXXZ"
829835// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
836+ // C32-DAG: define linkonce_odr dso_local void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
830837
831838// Attributes on the instantiation take precedence over attributes on the template.
832839template <typename T> struct __declspec (dllexport) ExplicitlyInstantiatedWithDifferentAttr { void f () {} };
@@ -842,6 +849,7 @@ USEMEMFUNC(ExplicitInstantiationDeclImportedDefTemplate<int>, f);
842849// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAEXXZ"
843850// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc ptr @"??0?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAE@XZ"
844851// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
852+ // C32-DAG: define weak_odr dso_local void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
845853
846854template <typename T> struct __declspec (dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate { void f () {} ExplicitInstantiationDeclExportedDefImportedTemplate () {} };
847855extern template struct __declspec (dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate <int >;
@@ -919,20 +927,23 @@ struct __declspec(dllimport) DerivedFromTemplate : public ClassTemplate<int> {};
919927USEMEMFUNC (ClassTemplate<int >, func)
920928// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$ClassTemplate@H@@QAEXXZ"
921929// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIiE4funcEv
930+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIiE4funcEv
922931// PS-DAG: declare dllimport void @_ZN13ClassTemplateIiE4funcEv
923932
924933// ImportedTemplate is explicitly imported.
925934struct __declspec (dllimport) DerivedFromImportedTemplate : public ImportedClassTemplate<int > {};
926935USEMEMFUNC (ImportedClassTemplate<int >, func)
927936// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ImportedClassTemplate@H@@QAEXXZ"
928937// G32-DAG: declare dllimport x86_thiscallcc void @_ZN21ImportedClassTemplateIiE4funcEv
938+ // C32-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
929939// PS-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
930940
931941// ExportedTemplate is explicitly exported.
932942struct __declspec (dllimport) DerivedFromExportedTemplate : public ExportedClassTemplate<int > {};
933943USEMEMFUNC (ExportedClassTemplate<int >, func)
934944// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExportedClassTemplate@H@@QAEXXZ"
935945// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN21ExportedClassTemplateIiE4funcEv
946+ // C32-DAG: define weak_odr dso_local dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
936947// PS-DAG: define weak_odr dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
937948
938949// Base class already implicitly instantiated without attribute.
@@ -941,6 +952,7 @@ struct __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double
941952USEMEMFUNC (ClassTemplate<double >, func)
942953// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ClassTemplate@N@@QAEXXZ"
943954// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv
955+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIdE4funcEv
944956// PS-DAG: declare dllimport void @_ZN13ClassTemplateIdE4funcEv
945957
946958// MS: Base class already instantiated with dfferent attribute.
@@ -949,48 +961,55 @@ struct __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate<bool>
949961USEMEMFUNC (ClassTemplate<bool >, func)
950962// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ClassTemplate@_N@@QAEXXZ"
951963// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIbE4funcEv
964+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIbE4funcEv
952965// PS-DAG: define weak_odr dllexport void @_ZN13ClassTemplateIbE4funcEv
953966
954967// Base class already specialized without dll attribute.
955968struct __declspec (dllimport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate<int > {};
956969USEMEMFUNC (ExplicitlySpecializedTemplate<int >, func)
957970// M32-DAG: define linkonce_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlySpecializedTemplate@H@@QAEXXZ"
958971// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
972+ // C32-DAG: define linkonce_odr dso_local void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
959973// PS-DAG: define linkonce_odr void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
960974
961975// Base class alredy specialized with export attribute.
962976struct __declspec (dllimport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate<int > {};
963977USEMEMFUNC (ExplicitlyExportSpecializedTemplate<int >, func)
964978// M32-DAG: define dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportSpecializedTemplate@H@@QAEXXZ"
965979// G32-DAG: define dso_local dllexport x86_thiscallcc void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
980+ // C32-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
966981// PS-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
967982
968983// Base class already specialized with import attribute.
969984struct __declspec (dllimport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int > {};
970985USEMEMFUNC (ExplicitlyImportSpecializedTemplate<int >, func)
971986// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ"
972987// G32-DAG: declare dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
988+ // C32-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
973989// PS-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
974990
975991// Base class already instantiated without dll attribute.
976992struct __declspec (dllimport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int > {};
977993USEMEMFUNC (ExplicitlyInstantiatedTemplate<int >, func)
978994// M32-DAG: define weak_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlyInstantiatedTemplate@H@@QAEXXZ"
979995// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
996+ // C32-DAG: define weak_odr dso_local void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
980997// PS-DAG: define weak_odr void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
981998
982999// Base class already instantiated with export attribute.
9831000struct __declspec (dllimport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate<int > {};
9841001USEMEMFUNC (ExplicitlyExportInstantiatedTemplate<int >, func)
9851002// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportInstantiatedTemplate@H@@QAEXXZ"
9861003// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
1004+ // C32-DAG: define weak_odr dso_local dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
9871005// PS-DAG: define weak_odr dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
9881006
9891007// Base class already instantiated with import attribute.
9901008struct __declspec (dllimport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int > {};
9911009USEMEMFUNC (ExplicitlyImportInstantiatedTemplate<int >, func)
9921010// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ"
9931011// G32-DAG: declare dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
1012+ // C32-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
9941013// PS-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
9951014
9961015// MS: A dll attribute propagates through multiple levels of instantiation.
@@ -1000,6 +1019,7 @@ struct __declspec(dllimport) BottomClass : public MiddleClass<int> { };
10001019USEMEMFUNC (TopClass<int >, func)
10011020// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$TopClass@H@@QAEXXZ"
10021021// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN8TopClassIiE4funcEv
1022+ // C32-DAG: define linkonce_odr dso_local void @_ZN8TopClassIiE4funcEv
10031023// PS-DAG: declare dllimport void @_ZN8TopClassIiE4funcEv
10041024
10051025template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func () {} };
@@ -1009,6 +1029,7 @@ template struct ExplicitInstantiationDeclTemplateBase<int>;
10091029USEMEMFUNC (ExplicitInstantiationDeclTemplateBase<int >, func)
10101030// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase@H@@QAEXXZ"
10111031// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
1032+ // C32-DAG: define weak_odr dso_local void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
10121033// PS-DAG: declare dllimport void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
10131034
10141035template <typename T> struct ExplicitInstantiationDeclTemplateBase2 { void func () {} };
@@ -1018,6 +1039,7 @@ template struct __declspec(dllexport) ExplicitInstantiationDeclTemplateBase2<int
10181039USEMEMFUNC (ExplicitInstantiationDeclTemplateBase2<int >, func)
10191040// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ"
10201041// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
1042+ // C32-DAG: define weak_odr dso_local void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
10211043// PS-DAG: declare dllimport void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
10221044
10231045namespace pr39496 {
0 commit comments