summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-02-22 17:59:16 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-02-22 17:59:16 +0000
commitdb1a47706bc4d849b5492e2beb066e538a8c4a84 (patch)
tree27c92a27221ccafa45f29efe79e18d3e759b55f4 /clang/lib/Sema/SemaDecl.cpp
parentf005d3c1a2a1d8c1f478d68e5024df11baa9d2be (diff)
downloadbcm5719-llvm-db1a47706bc4d849b5492e2beb066e538a8c4a84.tar.gz
bcm5719-llvm-db1a47706bc4d849b5492e2beb066e538a8c4a84.zip
Make sure pragmas don't attach visibility attributes to auto variables with
internal linkage. llvm-svn: 175903
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f062c0386d1..20c1b1015e4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4908,11 +4908,6 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
!NewVD->isInvalidDecl())
RegisterLocallyScopedExternCDecl(NewVD, Previous, S);
- // If there's a #pragma GCC visibility in scope, and this isn't a class
- // member, set the visibility of this variable.
- if (NewVD->getLinkage() == ExternalLinkage && !DC->isRecord())
- AddPushedVisibilityAttribute(NewVD);
-
return NewVD;
}
@@ -7880,10 +7875,16 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) {
// Note that we are no longer parsing the initializer for this declaration.
ParsingInitForAutoVars.erase(ThisDecl);
- const VarDecl *VD = dyn_cast_or_null<VarDecl>(ThisDecl);
+ VarDecl *VD = dyn_cast_or_null<VarDecl>(ThisDecl);
if (!VD)
return;
+ const DeclContext *DC = VD->getDeclContext();
+ // If there's a #pragma GCC visibility in scope, and this isn't a class
+ // member, set the visibility of this variable.
+ if (VD->getLinkage() == ExternalLinkage && !DC->isRecord())
+ AddPushedVisibilityAttribute(VD);
+
if (VD->isFileVarDecl())
MarkUnusedFileScopedDecl(VD);
OpenPOWER on IntegriCloud