summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-07-31 19:29:39 +0000
committerHans Wennborg <hans@hanshq.net>2014-07-31 19:29:39 +0000
commitf51dc3b5d410660e4b87daf78a8eea7ddd90d0b6 (patch)
tree7566f7ac9cd6130c82b297f5ecd749f9e09e7c96 /clang/lib/Sema/SemaDecl.cpp
parent3f0549f66b526229c3916168c44423a8cfde1e16 (diff)
downloadbcm5719-llvm-f51dc3b5d410660e4b87daf78a8eea7ddd90d0b6.tar.gz
bcm5719-llvm-f51dc3b5d410660e4b87daf78a8eea7ddd90d0b6.zip
Local extern redeclarations of dllimport variables stay dllimport even if they don't specify the attribute
llvm-svn: 214425
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 4abbbebf808..d24cf6a7bef 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5047,7 +5047,7 @@ static void checkDLLAttributeRedeclaration(Sema &S, NamedDecl *OldDecl,
}
// A redeclaration is not allowed to drop a dllimport attribute, the only
- // exception being inline function definitions.
+ // exceptions being inline function definitions and local extern declarations.
// NB: MSVC converts such a declaration to dllexport.
bool IsInline = false, IsStaticDataMember = false;
if (const auto *VD = dyn_cast<VarDecl>(NewDecl))
@@ -5057,7 +5057,8 @@ static void checkDLLAttributeRedeclaration(Sema &S, NamedDecl *OldDecl,
else if (const auto *FD = dyn_cast<FunctionDecl>(NewDecl))
IsInline = FD->isInlined();
- if (OldImportAttr && !HasNewAttr && !IsInline && !IsStaticDataMember) {
+ if (OldImportAttr && !HasNewAttr && !IsInline && !IsStaticDataMember &&
+ !NewDecl->isLocalExternDecl()) {
S.Diag(NewDecl->getLocation(),
diag::warn_redeclaration_without_attribute_prev_attribute_ignored)
<< NewDecl << OldImportAttr;
OpenPOWER on IntegriCloud