diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6497,7 +6497,9 @@ // special MSVC extension: in the last case, the declaration is treated as if // it were marked dllexport. bool IsInline = false, IsStaticDataMember = false, IsQualifiedFriend = false; - bool IsMicrosoft = S.Context.getTargetInfo().getCXXABI().isMicrosoft(); + bool IsMicrosoft = + S.Context.getTargetInfo().getCXXABI().isMicrosoft() || + S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment(); if (const auto *VD = dyn_cast(NewDecl)) { // Ignore static data because out-of-line definitions are diagnosed // separately. diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -6731,14 +6731,16 @@ static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A) { if (isa(D) && - S.Context.getTargetInfo().getCXXABI().isMicrosoft()) { + (S.Context.getTargetInfo().getCXXABI().isMicrosoft() || + S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())) { S.Diag(A.getRange().getBegin(), diag::warn_attribute_ignored) << A; return; } if (const auto *FD = dyn_cast(D)) { if (FD->isInlined() && A.getKind() == ParsedAttr::AT_DLLImport && - !S.Context.getTargetInfo().getCXXABI().isMicrosoft()) { + !(S.Context.getTargetInfo().getCXXABI().isMicrosoft() || + S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())) { // MinGW doesn't allow dllimport on inline functions. S.Diag(A.getRange().getBegin(), diag::warn_attribute_ignored_on_inline) << A; @@ -6747,7 +6749,8 @@ } if (const auto *MD = dyn_cast(D)) { - if (S.Context.getTargetInfo().getCXXABI().isMicrosoft() && + if ((S.Context.getTargetInfo().getCXXABI().isMicrosoft() || + S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) && MD->getParent()->isLambda()) { S.Diag(A.getRange().getBegin(), diag::err_attribute_dll_lambda) << A; return; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -6060,7 +6060,8 @@ Attr *ClassAttr = getDLLAttr(Class); // MSVC inherits DLL attributes to partial class template specializations. - if (Context.getTargetInfo().getCXXABI().isMicrosoft() && !ClassAttr) { + if ((Context.getTargetInfo().getCXXABI().isMicrosoft() || + Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) && !ClassAttr) { if (auto *Spec = dyn_cast(Class)) { if (Attr *TemplateAttr = getDLLAttr(Spec->getSpecializedTemplate()->getTemplatedDecl())) { @@ -6080,7 +6081,8 @@ return; } - if (Context.getTargetInfo().getCXXABI().isMicrosoft() && + if ((Context.getTargetInfo().getCXXABI().isMicrosoft() || + Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) && !ClassAttr->isInherited()) { // Diagnose dll attributes on members of class with dll attribute. for (Decl *Member : Class->decls()) { diff --git a/clang/test/Sema/dllimport.c b/clang/test/Sema/dllimport.c --- a/clang/test/Sema/dllimport.c +++ b/clang/test/Sema/dllimport.c @@ -1,8 +1,10 @@ -// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s -// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c11 -DMS %s -// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c11 -DGNU %s -// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c99 -DGNU %s -// RUN: %clang_cc1 -triple aarch64-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s +// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s +// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c11 -DMS %s +// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c11 -DGNU %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c99 -DGNU %s +// RUN: %clang_cc1 -triple aarch64-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s +// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c99 -DWI %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c11 -DWI %s // Invalid usage. __declspec(dllimport) typedef int typedef1; @@ -45,7 +47,7 @@ // expected-note@+2{{previous attribute is here}} #endif __declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -56,7 +58,7 @@ // expected-note@+2{{previous attribute is here}} #endif __declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -67,7 +69,7 @@ // expected-note@+2{{previous attribute is here}} #endif int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -78,7 +80,7 @@ // expected-note@+2{{previous attribute is here}} #endif int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -179,7 +181,7 @@ #endif __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} // NB: Both MSVC and Clang issue a warning and make redecl3 dllexport. -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -202,7 +204,7 @@ __declspec(dllimport) void redecl6(); inline void redecl6() {} -#ifdef MS +#if defined(MS) || defined (WI) // expected-note@+5{{previous declaration is here}} // expected-warning@+5{{redeclaration of 'redecl7' should not add 'dllimport' attribute}} #else diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp --- a/clang/test/SemaCXX/dllexport.cpp +++ b/clang/test/SemaCXX/dllexport.cpp @@ -1,7 +1,9 @@ -// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s -// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s -// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template %s -// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s +// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s +// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template %s +// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DWI %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DWI %s // Helper structs to make templates more expressive. struct ImplicitInst_Exported {}; @@ -349,7 +351,7 @@ class __declspec(dllexport) ClassDef {}; -#ifdef MS +#if defined(MS) || defined (WI) // expected-warning@+3{{'dllexport' attribute ignored}} #endif template struct PartiallySpecializedClassTemplate {}; @@ -367,13 +369,13 @@ // Don't instantiate class members of templates with explicit instantiation declarations, even if they are exported. struct IncompleteType2; -#ifdef MS +#if defined(MS) || defined (WI) // expected-note@+2{{attribute is here}} #endif template struct __declspec(dllexport) ExportedTemplateWithExplicitInstantiationDecl { int f() { return sizeof(T); } // no-error }; -#ifdef MS +#if defined(MS) || defined (WI) // expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} #endif extern template struct ExportedTemplateWithExplicitInstantiationDecl; @@ -408,13 +410,13 @@ // Warn about explicit instantiation declarations of dllexport classes. template struct ExplicitInstantiationDeclTemplate {}; -#ifdef MS +#if defined(MS) || defined (WI) // expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} expected-note@+2{{attribute is here}} #endif extern template struct __declspec(dllexport) ExplicitInstantiationDeclTemplate; template struct __declspec(dllexport) ExplicitInstantiationDeclExportedTemplate {}; -#ifdef MS +#if defined(MS) || defined (WI) // expected-note@-2{{attribute is here}} // expected-warning@+2{{explicit instantiation declaration should not be 'dllexport'}} #endif @@ -453,7 +455,7 @@ template struct __declspec(dllexport) ExplicitlyExportInstantiatedTemplate; template struct ExplicitlyExportDeclaredInstantiatedTemplate { void func() {} }; extern template struct ExplicitlyExportDeclaredInstantiatedTemplate; -#ifndef MS +#if not defined(MS) && not defined (WI) // expected-warning@+2{{'dllexport' attribute ignored on explicit instantiation definition}} #endif template struct __declspec(dllexport) ExplicitlyExportDeclaredInstantiatedTemplate; @@ -1164,7 +1166,7 @@ // Lambdas //===----------------------------------------------------------------------===// // The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported. -#ifdef MS +#if defined(MS) || defined (WI) // expected-error@+2{{lambda cannot be declared 'dllexport'}} #endif auto Lambda = []() __declspec(dllexport) -> bool { return true; }; diff --git a/clang/test/SemaCXX/dllimport.cpp b/clang/test/SemaCXX/dllimport.cpp --- a/clang/test/SemaCXX/dllimport.cpp +++ b/clang/test/SemaCXX/dllimport.cpp @@ -1,8 +1,10 @@ -// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s -// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s -// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DGNU %s -// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DGNU %s -// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++17 -Wunsupported-dll-base-class-template -DGNU %s +// RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DMS %s +// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DMS %s +// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c++1y -Wunsupported-dll-base-class-template -DGNU %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DGNU %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c++17 -Wunsupported-dll-base-class-template -DGNU %s +// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++11 -Wunsupported-dll-base-class-template -DWI %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c++17 -Wunsupported-dll-base-class-template -DWI %s // Helper structs to make templates more expressive. struct ImplicitInst_Imported {}; @@ -55,7 +57,7 @@ // expected-note@+2{{previous attribute is here}} #endif __declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -66,7 +68,7 @@ // expected-note@+2{{previous attribute is here}} #endif __declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -77,7 +79,7 @@ // expected-note@+2{{previous attribute is here}} #endif int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -88,7 +90,7 @@ // expected-note@+2{{previous attribute is here}} #endif int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -179,7 +181,7 @@ #endif template __declspec(dllimport) extern int ExternVarTmplDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -192,7 +194,7 @@ #endif template __declspec(dllimport) int VarTmplDeclInit; // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -307,7 +309,7 @@ #endif __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} // NB: Both MSVC and Clang issue a warning and make redecl3 dllexport. -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -322,7 +324,7 @@ __declspec(dllimport) void redecl5(); // expected-warning{{redeclaration of 'redecl5' should not add 'dllimport' attribute}} } -#ifdef MS +#if defined(MS) || defined(WI) void redecl6(); // expected-note{{previous declaration is here}} __declspec(dllimport) inline void redecl6() {} // expected-warning{{redeclaration of 'redecl6' should not add 'dllimport' attribute}} #else @@ -339,21 +341,21 @@ #endif friend __declspec(dllimport) void friend3(); // expected-note{{previous declaration is here}} friend void friend4(); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} #endif friend void friend5(); }; __declspec(dllimport) void friend1(); void friend2(); // expected-warning{{'friend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'friend3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'friend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} #endif void friend3() {} __declspec(dllimport) void friend4(); // expected-warning{{redeclaration of 'friend4' should not add 'dllimport' attribute}} -#ifdef MS +#if defined(MS) || defined(WI) __declspec(dllimport) inline void friend5() {} // expected-warning{{redeclaration of 'friend5' should not add 'dllimport' attribute}} #else __declspec(dllimport) inline void friend5() {} // expected-warning{{'dllimport' attribute ignored on inline function}} @@ -381,7 +383,7 @@ // here which is irrelevant. But because the delete keyword is parsed later // there is currently no straight-forward way to avoid this diagnostic. __declspec(dllimport) void deletedFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} expected-error{{dllimport cannot be applied to non-inline function definition}} -#ifdef MS +#if defined(MS) || defined(WI) __declspec(dllimport) inline void deletedInlineFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} #else __declspec(dllimport) inline void deletedInlineFunc() = delete; // expected-warning{{'dllimport' attribute ignored on inline function}} @@ -459,7 +461,7 @@ template void funcTmplFriend2(); // expected-warning{{'funcTmplFriend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} template void funcTmplFriend3() {} // expected-warning{{'funcTmplFriend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} template __declspec(dllimport) void funcTmplFriend4(); // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllimport' attribute}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+2{{'funcTmplFriend5' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} #endif template inline void funcTmplFriend5() {} @@ -593,13 +595,13 @@ __declspec(dllimport) constexpr static int ConstexprFieldDef = 1; }; -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} #endif void ImportMembers::Nested::normalDef() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -610,7 +612,7 @@ #endif inline void ImportMembers::normalInlineDef() {} void ImportMembers::normalInlineDecl() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -621,7 +623,7 @@ #endif inline void ImportMembers::virtualInlineDef() {} void ImportMembers::virtualInlineDecl() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -694,7 +696,7 @@ // Import deleted member functions. struct ImportDeleted { -#ifdef MS +#if defined(MS) || defined(WI) __declspec(dllimport) ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} __declspec(dllimport) ~ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} __declspec(dllimport) ImportDeleted(const ImportDeleted&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} @@ -767,7 +769,7 @@ // Not allowed on definitions. __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs() = default; // expected-error{{dllimport cannot be applied to non-inline function definition}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -784,7 +786,7 @@ inline ImportDefaultedDefs& ImportDefaultedDefs::operator=(const ImportDefaultedDefs&) = default; __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(ImportDefaultedDefs&&) = default; // expected-error{{dllimport cannot be applied to non-inline function definition}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+4{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -800,7 +802,7 @@ static void staticDef(); // expected-note{{previous declaration is here}} static inline void staticInlineDecl(); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+4{{previous declaration is here}} // expected-note@+4{{previous declaration is here}} // expected-note@+4{{previous declaration is here}} @@ -824,7 +826,7 @@ // expected-error@-1{{dllimport cannot be applied to non-inline function definition}} __declspec(dllimport) void MemberRedecl::staticInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::staticInlineDecl' cannot add 'dllimport' attribute}} -#ifdef MS +#if defined(MS) || defined(WI) __declspec(dllimport) inline void MemberRedecl::normalInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::normalInlineDef' cannot add 'dllimport' attribute}} __declspec(dllimport) inline void MemberRedecl::virtualInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDef' cannot add 'dllimport' attribute}} __declspec(dllimport) inline void MemberRedecl::staticInlineDef() {} // expected-error{{redeclaration of 'MemberRedecl::staticInlineDef' cannot add 'dllimport' attribute}} @@ -861,13 +863,13 @@ struct ImportMemberTmpl { template __declspec(dllimport) void normalDecl(); template __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) void normalInlineDef(); template __declspec(dllimport) static void staticDecl(); template __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) static void staticInlineDef(); @@ -930,7 +932,7 @@ template static void staticDef(); // expected-note{{previous declaration is here}} template static inline void staticInlineDecl(); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+3{{previous declaration is here}} // expected-note@+3{{previous declaration is here}} #endif @@ -948,7 +950,7 @@ template __declspec(dllimport) void MemTmplRedecl::normalDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalDef' cannot add 'dllimport' attribute}} // expected-error@-1{{dllimport cannot be applied to non-inline function definition}} -#ifdef MS +#if defined(MS) || defined(WI) template __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllimport' attribute}} #else template __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}} @@ -956,7 +958,7 @@ template __declspec(dllimport) void MemTmplRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllimport' attribute}} template __declspec(dllimport) void MemTmplRedecl::staticDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllimport' attribute}} // expected-error@-1{{dllimport cannot be applied to non-inline function definition}} -#ifdef MS +#if defined(MS) || defined(WI) template __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllimport' attribute}} #else template __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}} @@ -1189,7 +1191,7 @@ // NB: MSVC is inconsistent here and disallows *InlineDef on class templates, // but allows it on classes. We allow both. -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -1201,7 +1203,7 @@ #endif template inline void ImportClassTmplMembers::normalInlineDef() {} template void ImportClassTmplMembers::normalInlineDecl() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -1213,7 +1215,7 @@ #endif template inline void ImportClassTmplMembers::virtualInlineDef() {} template void ImportClassTmplMembers::virtualInlineDecl() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+5{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+3{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -1244,7 +1246,7 @@ static void staticDef(); // expected-note{{previous declaration is here}} static inline void staticInlineDecl(); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+4{{previous declaration is here}} // expected-note@+4{{previous declaration is here}} // expected-note@+4{{previous declaration is here}} @@ -1268,7 +1270,7 @@ // expected-error@-1{{dllimport cannot be applied to non-inline function definition}} template __declspec(dllimport) void CTMR::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllimport' attribute}} -#ifdef MS +#if defined(MS) || defined(WI) template __declspec(dllimport) inline void CTMR::normalInlineDef() {} // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllimport' attribute}} template __declspec(dllimport) inline void CTMR::virtualInlineDef() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllimport' attribute}} template __declspec(dllimport) inline void CTMR::staticInlineDef() {} // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllimport' attribute}} @@ -1304,13 +1306,13 @@ struct ImportClsTmplMemTmpl { template __declspec(dllimport) void normalDecl(); template __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) void normalInlineDef(); template __declspec(dllimport) static void staticDecl(); template __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) static void staticInlineDef(); @@ -1322,12 +1324,12 @@ // expected-warning@+11{{'dllimport' attribute ignored on inline function}} #endif template __declspec(dllimport) void normalInclass() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) inline void normalInlineDecl(); template __declspec(dllimport) static void staticInclass() {} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+2{{previous declaration is here}} expected-note@+2{{previous attribute is here}} #endif template __declspec(dllimport) static inline void staticInlineDecl(); @@ -1381,7 +1383,7 @@ template static void staticDef(); // expected-note{{previous declaration is here}} template static inline void staticInlineDecl(); // expected-note{{previous declaration is here}} -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+3{{previous declaration is here}} // expected-note@+3{{previous declaration is here}} #endif @@ -1404,7 +1406,7 @@ // expected-error@-1{{dllimport cannot be applied to non-inline function definition}} template template __declspec(dllimport) void CTMTR::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllimport' attribute}} -#ifdef MS +#if defined(MS) || defined(WI) template template __declspec(dllimport) inline void CTMTR::normalInlineDef() {} // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllimport' attribute}} template template __declspec(dllimport) inline void CTMTR::staticInlineDef() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllimport' attribute}} #else @@ -1441,7 +1443,7 @@ template class ClassTemplate {}; -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+5{{previous attribute is here}} // expected-note@+4{{previous attribute is here}} // expected-error@+4{{attribute 'dllexport' cannot be applied to member of 'dllimport' class}} @@ -1452,7 +1454,7 @@ void __declspec(dllimport) bar(); }; -#ifdef MS +#if defined(MS) || defined(WI) // expected-note@+5{{previous attribute is here}} // expected-note@+4{{previous attribute is here}} // expected-error@+4{{attribute 'dllimport' cannot be applied to member of 'dllexport' class}} @@ -1478,7 +1480,7 @@ S s; } -#ifdef MS +#if defined(MS) || defined(WI) // expected-warning@+3{{'dllimport' attribute ignored}} #endif template struct PartiallySpecializedClassTemplate {}; @@ -1572,7 +1574,7 @@ // Lambdas //===----------------------------------------------------------------------===// // The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported. -#ifdef MS +#if defined(MS) || defined(WI) // expected-error@+4{{lambda cannot be declared 'dllimport'}} #else // expected-warning@+2{{'dllimport' attribute ignored on inline function}}