[clang] a9f1bb9 - Revert "first upstream review"
Ben Dunbobbin via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 9 05:23:42 PDT 2020
Author: Ben Dunbobbin
Date: 2020-10-09T13:22:46+01:00
New Revision: a9f1bb92bfb1efc005b53bf9ea18ad5e902386fc
URL: https://github.com/llvm/llvm-project/commit/a9f1bb92bfb1efc005b53bf9ea18ad5e902386fc
DIFF: https://github.com/llvm/llvm-project/commit/a9f1bb92bfb1efc005b53bf9ea18ad5e902386fc.diff
LOG: Revert "first upstream review"
Pushed by accident :(
This reverts commit 4eb627ed96e3f2f9f24aec8a0654ce5204874bb8.
Added:
Modified:
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/Sema/dllimport.c
clang/test/SemaCXX/dllexport.cpp
clang/test/SemaCXX/dllimport.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9a6682e837dd..c92d906580eb 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6497,9 +6497,7 @@ static void checkDLLAttributeRedeclaration(Sema &S, NamedDecl *OldDecl,
// 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() ||
- S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment();
+ bool IsMicrosoft = S.Context.getTargetInfo().getCXXABI().isMicrosoft();
if (const auto *VD = dyn_cast<VarDecl>(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
index 0ccfb1504636..c07e5f792d14 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6731,16 +6731,14 @@ DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D,
static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A) {
if (isa<ClassTemplatePartialSpecializationDecl>(D) &&
- (S.Context.getTargetInfo().getCXXABI().isMicrosoft() ||
- S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())) {
+ S.Context.getTargetInfo().getCXXABI().isMicrosoft()) {
S.Diag(A.getRange().getBegin(), diag::warn_attribute_ignored) << A;
return;
}
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
if (FD->isInlined() && A.getKind() == ParsedAttr::AT_DLLImport &&
- !(S.Context.getTargetInfo().getCXXABI().isMicrosoft() ||
- S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())) {
+ !S.Context.getTargetInfo().getCXXABI().isMicrosoft()) {
// MinGW doesn't allow dllimport on inline functions.
S.Diag(A.getRange().getBegin(), diag::warn_attribute_ignored_on_inline)
<< A;
@@ -6749,8 +6747,7 @@ static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A) {
}
if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
- if ((S.Context.getTargetInfo().getCXXABI().isMicrosoft() ||
- S.Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) &&
+ if (S.Context.getTargetInfo().getCXXABI().isMicrosoft() &&
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
index 138faa161c4e..1275fc0c95b5 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -6060,8 +6060,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
Attr *ClassAttr = getDLLAttr(Class);
// MSVC inherits DLL attributes to partial class template specializations.
- if ((Context.getTargetInfo().getCXXABI().isMicrosoft() ||
- Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) && !ClassAttr) {
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() && !ClassAttr) {
if (auto *Spec = dyn_cast<ClassTemplatePartialSpecializationDecl>(Class)) {
if (Attr *TemplateAttr =
getDLLAttr(Spec->getSpecializedTemplate()->getTemplatedDecl())) {
@@ -6081,8 +6080,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
return;
}
- if ((Context.getTargetInfo().getCXXABI().isMicrosoft() ||
- Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) &&
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
!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
index 66bd2703e648..988a8e33a7ef 100644
--- a/clang/test/Sema/dllimport.c
+++ b/clang/test/Sema/dllimport.c
@@ -1,10 +1,8 @@
-// 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
+// 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
// Invalid usage.
__declspec(dllimport) typedef int typedef1;
@@ -47,7 +45,7 @@ int __declspec(dllimport) GlobalInit2 = 1; // expected-error{{definition of dlli
// expected-note at +2{{previous attribute is here}}
#endif
__declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -58,7 +56,7 @@ int ExternGlobalDeclInit = 1;
// expected-note at +2{{previous attribute is here}}
#endif
__declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -69,7 +67,7 @@ int GlobalDeclInit = 1;
// expected-note at +2{{previous attribute is here}}
#endif
int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -80,7 +78,7 @@ int *GlobalDeclChunkAttrInit = 0;
// expected-note at +2{{previous attribute is here}}
#endif
int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -181,7 +179,7 @@ __declspec(dllimport) void redecl2(); // expected-note{{previous declaration is
#endif
__declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}}
// NB: Both MSVC and Clang issue a warning and make redecl3 dllexport.
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -204,7 +202,7 @@ __declspec(dllimport) void redecl5(); // expected-warning{{redeclaration of 'red
__declspec(dllimport) void redecl6();
inline void redecl6() {}
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-note at +5{{previous declaration is here}}
// expected-warning at +5{{redeclaration of 'redecl7' should not add 'dllimport' attribute}}
#else
diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp
index cef2f13cac42..953684c73a58 100644
--- a/clang/test/SemaCXX/dllexport.cpp
+++ b/clang/test/SemaCXX/dllexport.cpp
@@ -1,9 +1,7 @@
-// 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
+// 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
// Helper structs to make templates more expressive.
struct ImplicitInst_Exported {};
@@ -351,7 +349,7 @@ class __declspec(dllexport) ClassDecl;
class __declspec(dllexport) ClassDef {};
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-warning at +3{{'dllexport' attribute ignored}}
#endif
template <typename T> struct PartiallySpecializedClassTemplate {};
@@ -369,13 +367,13 @@ ImplicitlyInstantiatedExportedTemplate<IncompleteType> implicitlyInstantiatedExp
// Don't instantiate class members of templates with explicit instantiation declarations, even if they are exported.
struct IncompleteType2;
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-note at +2{{attribute is here}}
#endif
template <typename T> struct __declspec(dllexport) ExportedTemplateWithExplicitInstantiationDecl {
int f() { return sizeof(T); } // no-error
};
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-warning at +2{{explicit instantiation declaration should not be 'dllexport'}}
#endif
extern template struct ExportedTemplateWithExplicitInstantiationDecl<IncompleteType2>;
@@ -410,13 +408,13 @@ struct __declspec(dllexport) ExportedBaseClass2 : public ExportedBaseClassTempla
// Warn about explicit instantiation declarations of dllexport classes.
template <typename T> struct ExplicitInstantiationDeclTemplate {};
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-warning at +2{{explicit instantiation declaration should not be 'dllexport'}} expected-note at +2{{attribute is here}}
#endif
extern template struct __declspec(dllexport) ExplicitInstantiationDeclTemplate<int>;
template <typename T> struct __declspec(dllexport) ExplicitInstantiationDeclExportedTemplate {};
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-note at -2{{attribute is here}}
// expected-warning at +2{{explicit instantiation declaration should not be 'dllexport'}}
#endif
@@ -455,7 +453,7 @@ template <typename T> struct ExplicitlyExportInstantiatedTemplate { void func()
template struct __declspec(dllexport) ExplicitlyExportInstantiatedTemplate<int>;
template <typename T> struct ExplicitlyExportDeclaredInstantiatedTemplate { void func() {} };
extern template struct ExplicitlyExportDeclaredInstantiatedTemplate<int>;
-#if not defined(MS) && not defined (WI)
+#ifndef MS
// expected-warning at +2{{'dllexport' attribute ignored on explicit instantiation definition}}
#endif
template struct __declspec(dllexport) ExplicitlyExportDeclaredInstantiatedTemplate<int>;
@@ -1166,7 +1164,7 @@ template<typename T> template<typename U> __declspec(dllexport) constexpr int CT
// Lambdas
//===----------------------------------------------------------------------===//
// The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported.
-#if defined(MS) || defined (WI)
+#ifdef MS
// expected-error at +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
index f0c77904b618..80c6f2e67858 100644
--- a/clang/test/SemaCXX/dllimport.cpp
+++ b/clang/test/SemaCXX/dllimport.cpp
@@ -1,10 +1,8 @@
-// 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
+// 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
// Helper structs to make templates more expressive.
struct ImplicitInst_Imported {};
@@ -57,7 +55,7 @@ int __declspec(dllimport) GlobalInit2 = 1; // expected-error{{definition of dlli
// expected-note at +2{{previous attribute is here}}
#endif
__declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -68,7 +66,7 @@ int ExternGlobalDeclInit = 1;
// expected-note at +2{{previous attribute is here}}
#endif
__declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -79,7 +77,7 @@ int GlobalDeclInit = 1;
// expected-note at +2{{previous attribute is here}}
#endif
int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -90,7 +88,7 @@ int *GlobalDeclChunkAttrInit = 0;
// expected-note at +2{{previous attribute is here}}
#endif
int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -181,7 +179,7 @@ template<typename T> int __declspec(dllimport) VarTmplInit2 = 1; // expected-err
#endif
template <typename T>
__declspec(dllimport) extern int ExternVarTmplDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -194,7 +192,7 @@ int ExternVarTmplDeclInit = 1;
#endif
template <typename T>
__declspec(dllimport) int VarTmplDeclInit; // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -309,7 +307,7 @@ __declspec(dllimport) void redecl2(); // expected-note{{previous declaration is
#endif
__declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}}
// NB: Both MSVC and Clang issue a warning and make redecl3 dllexport.
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -324,7 +322,7 @@ extern "C" {
__declspec(dllimport) void redecl5(); // expected-warning{{redeclaration of 'redecl5' should not add 'dllimport' attribute}}
}
-#if defined(MS) || defined(WI)
+#ifdef MS
void redecl6(); // expected-note{{previous declaration is here}}
__declspec(dllimport) inline void redecl6() {} // expected-warning{{redeclaration of 'redecl6' should not add 'dllimport' attribute}}
#else
@@ -341,21 +339,21 @@ struct FuncFriend {
#endif
friend __declspec(dllimport) void friend3(); // expected-note{{previous declaration is here}}
friend void friend4(); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +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}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'friend3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +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}}
-#if defined(MS) || defined(WI)
+#ifdef MS
__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}}
@@ -383,7 +381,7 @@ namespace ns { __declspec(dllimport) void externalFunc(); }
// 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}}
-#if defined(MS) || defined(WI)
+#ifdef MS
__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}}
@@ -461,7 +459,7 @@ template<typename T> __declspec(dllimport) void funcTmplFriend1();
template<typename T> void funcTmplFriend2(); // expected-warning{{'funcTmplFriend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
template<typename T> void funcTmplFriend3() {} // expected-warning{{'funcTmplFriend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
template<typename T> __declspec(dllimport) void funcTmplFriend4(); // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllimport' attribute}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +2{{'funcTmplFriend5' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
#endif
template<typename T> inline void funcTmplFriend5() {}
@@ -595,13 +593,13 @@ struct ImportMembers {
__declspec(dllimport) constexpr static int ConstexprFieldDef = 1;
};
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
#endif
void ImportMembers::Nested::normalDef() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -612,7 +610,7 @@ void ImportMembers::normalDef() {}
#endif
inline void ImportMembers::normalInlineDef() {}
void ImportMembers::normalInlineDecl() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -623,7 +621,7 @@ inline void ImportMembers::normalInlineDef() {}
#endif
inline void ImportMembers::virtualInlineDef() {}
void ImportMembers::virtualInlineDecl() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -696,7 +694,7 @@ struct ImportSpecials {
// Import deleted member functions.
struct ImportDeleted {
-#if defined(MS) || defined(WI)
+#ifdef MS
__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}}
@@ -769,7 +767,7 @@ struct ImportDefaultedDefs {
// Not allowed on definitions.
__declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs() = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -786,7 +784,7 @@ __declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(const ImportDefau
inline ImportDefaultedDefs& ImportDefaultedDefs::operator=(const ImportDefaultedDefs&) = default;
__declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(ImportDefaultedDefs&&) = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +4{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +2{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -802,7 +800,7 @@ struct MemberRedecl {
static void staticDef(); // expected-note{{previous declaration is here}}
static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +4{{previous declaration is here}}
// expected-note at +4{{previous declaration is here}}
// expected-note at +4{{previous declaration is here}}
@@ -826,7 +824,7 @@ __declspec(dllimport) void MemberRedecl::staticDef() {} // expect
// expected-error at -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}}
-#if defined(MS) || defined(WI)
+#ifdef MS
__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}}
@@ -863,13 +861,13 @@ __declspec(dllimport) constexpr int MemberRedecl::ConstexprField;
struct ImportMemberTmpl {
template<typename T> __declspec(dllimport) void normalDecl();
template<typename T> __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename T> __declspec(dllimport) void normalInlineDef();
template<typename T> __declspec(dllimport) static void staticDecl();
template<typename T> __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename T> __declspec(dllimport) static void staticInlineDef();
@@ -932,7 +930,7 @@ struct MemTmplRedecl {
template<typename T> static void staticDef(); // expected-note{{previous declaration is here}}
template<typename T> static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +3{{previous declaration is here}}
// expected-note at +3{{previous declaration is here}}
#endif
@@ -950,7 +948,7 @@ struct MemTmplRedecl {
template<typename T> __declspec(dllimport) void MemTmplRedecl::normalDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalDef' cannot add 'dllimport' attribute}}
// expected-error at -1{{dllimport cannot be applied to non-inline function definition}}
-#if defined(MS) || defined(WI)
+#ifdef MS
template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllimport' attribute}}
#else
template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
@@ -958,7 +956,7 @@ template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInli
template<typename T> __declspec(dllimport) void MemTmplRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllimport' attribute}}
template<typename T> __declspec(dllimport) void MemTmplRedecl::staticDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllimport' attribute}}
// expected-error at -1{{dllimport cannot be applied to non-inline function definition}}
-#if defined(MS) || defined(WI)
+#ifdef MS
template<typename T> __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllimport' attribute}}
#else
template<typename T> __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {} // expected-warning{{'dllimport' attribute ignored on inline function}}
@@ -1191,7 +1189,7 @@ struct ImportClassTmplMembers {
// NB: MSVC is inconsistent here and disallows *InlineDef on class templates,
// but allows it on classes. We allow both.
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -1203,7 +1201,7 @@ void ImportClassTmplMembers<T>::normalDef() {}
#endif
template<typename T> inline void ImportClassTmplMembers<T>::normalInlineDef() {}
template<typename T> void ImportClassTmplMembers<T>::normalInlineDecl() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -1215,7 +1213,7 @@ void ImportClassTmplMembers<T>::virtualDef() {}
#endif
template<typename T> inline void ImportClassTmplMembers<T>::virtualInlineDef() {}
template<typename T> void ImportClassTmplMembers<T>::virtualInlineDecl() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +5{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
#else
// expected-warning at +3{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
@@ -1246,7 +1244,7 @@ struct CTMR /*ClassTmplMemberRedecl*/ {
static void staticDef(); // expected-note{{previous declaration is here}}
static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +4{{previous declaration is here}}
// expected-note at +4{{previous declaration is here}}
// expected-note at +4{{previous declaration is here}}
@@ -1270,7 +1268,7 @@ template<typename T> __declspec(dllimport) void CTMR<T>::staticDef() {}
// expected-error at -1{{dllimport cannot be applied to non-inline function definition}}
template<typename T> __declspec(dllimport) void CTMR<T>::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllimport' attribute}}
-#if defined(MS) || defined(WI)
+#ifdef MS
template<typename T> __declspec(dllimport) inline void CTMR<T>::normalInlineDef() {} // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllimport' attribute}}
template<typename T> __declspec(dllimport) inline void CTMR<T>::virtualInlineDef() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllimport' attribute}}
template<typename T> __declspec(dllimport) inline void CTMR<T>::staticInlineDef() {} // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllimport' attribute}}
@@ -1306,13 +1304,13 @@ template<typename T>
struct ImportClsTmplMemTmpl {
template<typename U> __declspec(dllimport) void normalDecl();
template<typename U> __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename U> __declspec(dllimport) void normalInlineDef();
template<typename U> __declspec(dllimport) static void staticDecl();
template<typename U> __declspec(dllimport) static void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename U> __declspec(dllimport) static void staticInlineDef();
@@ -1324,12 +1322,12 @@ struct ImportClsTmplMemTmpl {
// expected-warning at +11{{'dllimport' attribute ignored on inline function}}
#endif
template<typename U> __declspec(dllimport) void normalInclass() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename U> __declspec(dllimport) inline void normalInlineDecl();
template<typename U> __declspec(dllimport) static void staticInclass() {}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +2{{previous declaration is here}} expected-note at +2{{previous attribute is here}}
#endif
template<typename U> __declspec(dllimport) static inline void staticInlineDecl();
@@ -1383,7 +1381,7 @@ struct CTMTR /*ClassTmplMemberTmplRedecl*/ {
template<typename U> static void staticDef(); // expected-note{{previous declaration is here}}
template<typename U> static inline void staticInlineDecl(); // expected-note{{previous declaration is here}}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +3{{previous declaration is here}}
// expected-note at +3{{previous declaration is here}}
#endif
@@ -1406,7 +1404,7 @@ template<typename T> template<typename U> __declspec(dllimport) void CTMT
// expected-error at -1{{dllimport cannot be applied to non-inline function definition}}
template<typename T> template<typename U> __declspec(dllimport) void CTMTR<T>::staticInlineDecl() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllimport' attribute}}
-#if defined(MS) || defined(WI)
+#ifdef MS
template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::normalInlineDef() {} // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllimport' attribute}}
template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::staticInlineDef() {} // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllimport' attribute}}
#else
@@ -1443,7 +1441,7 @@ class __declspec(dllimport) ClassDef { };
template <typename T> class ClassTemplate {};
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +5{{previous attribute is here}}
// expected-note at +4{{previous attribute is here}}
// expected-error at +4{{attribute 'dllexport' cannot be applied to member of 'dllimport' class}}
@@ -1454,7 +1452,7 @@ class __declspec(dllimport) ImportClassWithDllMember {
void __declspec(dllimport) bar();
};
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-note at +5{{previous attribute is here}}
// expected-note at +4{{previous attribute is here}}
// expected-error at +4{{attribute 'dllimport' cannot be applied to member of 'dllexport' class}}
@@ -1480,7 +1478,7 @@ template <typename> struct __declspec(dllimport) S {
S<int> s;
}
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-warning at +3{{'dllimport' attribute ignored}}
#endif
template <typename T> struct PartiallySpecializedClassTemplate {};
@@ -1574,7 +1572,7 @@ struct __declspec(dllimport) DerivedFromExplicitInstantiationDeclTemplateBase :
// Lambdas
//===----------------------------------------------------------------------===//
// The MS ABI doesn't provide a stable mangling for lambdas, so they can't be imported or exported.
-#if defined(MS) || defined(WI)
+#ifdef MS
// expected-error at +4{{lambda cannot be declared 'dllimport'}}
#else
// expected-warning at +2{{'dllimport' attribute ignored on inline function}}
More information about the cfe-commits
mailing list