2
2
// 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
3
3
// 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
4
4
// 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
5
7
// 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
6
8
// 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
7
9
// 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
10
12
11
13
// CHECK-NOT doesn't play nice with CHECK-DAG, so use separate run lines.
12
14
// 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
13
15
// 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
14
17
15
18
// Helper structs to make templates more expressive.
16
19
struct ImplicitInst_Imported {};
@@ -205,7 +208,7 @@ USEVAR(VarTmpl<ExplicitSpec_Imported>)
205
208
// Functions
206
209
// ===----------------------------------------------------------------------===//
207
210
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}})
209
212
210
213
// Import function declaration.
211
214
// MSC-DAG: declare dllimport void @"?decl@@YAXXZ"()
@@ -311,7 +314,7 @@ USE(friend5)
311
314
312
315
// Implicit declarations can be redeclared with dllimport.
313
316
// 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 ]}}(
315
318
__declspec(dllimport) void* operator new(__SIZE_TYPE__ n);
316
319
void UNIQ (use)() { ::operator new (42 ); }
317
320
@@ -677,6 +680,7 @@ struct __declspec(dllimport) KeyFuncClass {
677
680
};
678
681
extern constexpr KeyFuncClass keyFuncClassVar = {};
679
682
// G32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
683
+ // C32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
680
684
681
685
struct __declspec (dllimport) X : public virtual W {};
682
686
USECLASS (X)
@@ -813,20 +817,23 @@ template <typename T> struct __declspec(dllimport) PartiallySpecializedClassTemp
813
817
USEMEMFUNC (PartiallySpecializedClassTemplate<void *>, f);
814
818
// M32-DAG: declare dso_local x86_thiscallcc void @"?f@?$PartiallySpecializedClassTemplate@PAX@@QAEXXZ"
815
819
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
820
+ // C32-DAG: declare dllimport void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
816
821
817
822
// Attributes on explicit specializations are honored.
818
823
template <typename T> struct ExplicitlySpecializedClassTemplate {};
819
824
template <> struct __declspec (dllimport) ExplicitlySpecializedClassTemplate<void *> { void f (); };
820
825
USEMEMFUNC (ExplicitlySpecializedClassTemplate<void *>, f);
821
826
// M32-DAG: declare dllimport x86_thiscallcc void @"?f@?$ExplicitlySpecializedClassTemplate@PAX@@QAEXXZ"
822
827
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
828
+ // C32-DAG: declare dllimport void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
823
829
824
830
// MS inherits DLL attributes to partial specializations.
825
831
template <typename T> struct __declspec (dllimport) PartiallySpecializedImportedClassTemplate {};
826
832
template <typename T> struct PartiallySpecializedImportedClassTemplate <T*> { void f () {} };
827
833
USEMEMFUNC (PartiallySpecializedImportedClassTemplate<void *>, f);
828
834
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$PartiallySpecializedImportedClassTemplate@PAX@@QAEXXZ"
829
835
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
836
+ // C32-DAG: define linkonce_odr dso_local void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
830
837
831
838
// Attributes on the instantiation take precedence over attributes on the template.
832
839
template <typename T> struct __declspec (dllexport) ExplicitlyInstantiatedWithDifferentAttr { void f () {} };
@@ -842,6 +849,7 @@ USEMEMFUNC(ExplicitInstantiationDeclImportedDefTemplate<int>, f);
842
849
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAEXXZ"
843
850
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc ptr @"??0?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAE@XZ"
844
851
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
852
+ // C32-DAG: define weak_odr dso_local void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
845
853
846
854
template <typename T> struct __declspec (dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate { void f () {} ExplicitInstantiationDeclExportedDefImportedTemplate () {} };
847
855
extern template struct __declspec (dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate <int >;
@@ -919,20 +927,23 @@ struct __declspec(dllimport) DerivedFromTemplate : public ClassTemplate<int> {};
919
927
USEMEMFUNC (ClassTemplate<int >, func)
920
928
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$ClassTemplate@H@@QAEXXZ"
921
929
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIiE4funcEv
930
+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIiE4funcEv
922
931
// PS-DAG: declare dllimport void @_ZN13ClassTemplateIiE4funcEv
923
932
924
933
// ImportedTemplate is explicitly imported.
925
934
struct __declspec (dllimport) DerivedFromImportedTemplate : public ImportedClassTemplate<int > {};
926
935
USEMEMFUNC (ImportedClassTemplate<int >, func)
927
936
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ImportedClassTemplate@H@@QAEXXZ"
928
937
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN21ImportedClassTemplateIiE4funcEv
938
+ // C32-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
929
939
// PS-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
930
940
931
941
// ExportedTemplate is explicitly exported.
932
942
struct __declspec (dllimport) DerivedFromExportedTemplate : public ExportedClassTemplate<int > {};
933
943
USEMEMFUNC (ExportedClassTemplate<int >, func)
934
944
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExportedClassTemplate@H@@QAEXXZ"
935
945
// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN21ExportedClassTemplateIiE4funcEv
946
+ // C32-DAG: define weak_odr dso_local dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
936
947
// PS-DAG: define weak_odr dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
937
948
938
949
// Base class already implicitly instantiated without attribute.
@@ -941,6 +952,7 @@ struct __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double
941
952
USEMEMFUNC (ClassTemplate<double >, func)
942
953
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ClassTemplate@N@@QAEXXZ"
943
954
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv
955
+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIdE4funcEv
944
956
// PS-DAG: declare dllimport void @_ZN13ClassTemplateIdE4funcEv
945
957
946
958
// MS: Base class already instantiated with dfferent attribute.
@@ -949,48 +961,55 @@ struct __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate<bool>
949
961
USEMEMFUNC (ClassTemplate<bool >, func)
950
962
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ClassTemplate@_N@@QAEXXZ"
951
963
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIbE4funcEv
964
+ // C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIbE4funcEv
952
965
// PS-DAG: define weak_odr dllexport void @_ZN13ClassTemplateIbE4funcEv
953
966
954
967
// Base class already specialized without dll attribute.
955
968
struct __declspec (dllimport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate<int > {};
956
969
USEMEMFUNC (ExplicitlySpecializedTemplate<int >, func)
957
970
// M32-DAG: define linkonce_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlySpecializedTemplate@H@@QAEXXZ"
958
971
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
972
+ // C32-DAG: define linkonce_odr dso_local void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
959
973
// PS-DAG: define linkonce_odr void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
960
974
961
975
// Base class alredy specialized with export attribute.
962
976
struct __declspec (dllimport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate<int > {};
963
977
USEMEMFUNC (ExplicitlyExportSpecializedTemplate<int >, func)
964
978
// M32-DAG: define dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportSpecializedTemplate@H@@QAEXXZ"
965
979
// G32-DAG: define dso_local dllexport x86_thiscallcc void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
980
+ // C32-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
966
981
// PS-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
967
982
968
983
// Base class already specialized with import attribute.
969
984
struct __declspec (dllimport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int > {};
970
985
USEMEMFUNC (ExplicitlyImportSpecializedTemplate<int >, func)
971
986
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ"
972
987
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
988
+ // C32-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
973
989
// PS-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
974
990
975
991
// Base class already instantiated without dll attribute.
976
992
struct __declspec (dllimport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int > {};
977
993
USEMEMFUNC (ExplicitlyInstantiatedTemplate<int >, func)
978
994
// M32-DAG: define weak_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlyInstantiatedTemplate@H@@QAEXXZ"
979
995
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
996
+ // C32-DAG: define weak_odr dso_local void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
980
997
// PS-DAG: define weak_odr void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
981
998
982
999
// Base class already instantiated with export attribute.
983
1000
struct __declspec (dllimport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate<int > {};
984
1001
USEMEMFUNC (ExplicitlyExportInstantiatedTemplate<int >, func)
985
1002
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportInstantiatedTemplate@H@@QAEXXZ"
986
1003
// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
1004
+ // C32-DAG: define weak_odr dso_local dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
987
1005
// PS-DAG: define weak_odr dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
988
1006
989
1007
// Base class already instantiated with import attribute.
990
1008
struct __declspec (dllimport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int > {};
991
1009
USEMEMFUNC (ExplicitlyImportInstantiatedTemplate<int >, func)
992
1010
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ"
993
1011
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
1012
+ // C32-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
994
1013
// PS-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
995
1014
996
1015
// MS: A dll attribute propagates through multiple levels of instantiation.
@@ -1000,6 +1019,7 @@ struct __declspec(dllimport) BottomClass : public MiddleClass<int> { };
1000
1019
USEMEMFUNC (TopClass<int >, func)
1001
1020
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$TopClass@H@@QAEXXZ"
1002
1021
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN8TopClassIiE4funcEv
1022
+ // C32-DAG: define linkonce_odr dso_local void @_ZN8TopClassIiE4funcEv
1003
1023
// PS-DAG: declare dllimport void @_ZN8TopClassIiE4funcEv
1004
1024
1005
1025
template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func () {} };
@@ -1009,6 +1029,7 @@ template struct ExplicitInstantiationDeclTemplateBase<int>;
1009
1029
USEMEMFUNC (ExplicitInstantiationDeclTemplateBase<int >, func)
1010
1030
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase@H@@QAEXXZ"
1011
1031
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
1032
+ // C32-DAG: define weak_odr dso_local void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
1012
1033
// PS-DAG: declare dllimport void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
1013
1034
1014
1035
template <typename T> struct ExplicitInstantiationDeclTemplateBase2 { void func () {} };
@@ -1018,6 +1039,7 @@ template struct __declspec(dllexport) ExplicitInstantiationDeclTemplateBase2<int
1018
1039
USEMEMFUNC (ExplicitInstantiationDeclTemplateBase2<int >, func)
1019
1040
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ"
1020
1041
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
1042
+ // C32-DAG: define weak_odr dso_local void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
1021
1043
// PS-DAG: declare dllimport void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
1022
1044
1023
1045
namespace pr39496 {
0 commit comments