diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-02-22 17:59:16 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-02-22 17:59:16 +0000 |
commit | 4c8cba87e49ec2fd39c1ff3b903924e791734a8a (patch) | |
tree | bf2023b071afdac289befa5aae67891b0be8a07f /lib/Sema | |
parent | f23546a913825bdc1f972f21f638a6ee472aab20 (diff) |
Make sure pragmas don't attach visibility attributes to auto variables with
internal linkage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f062c0386d..20c1b1015e 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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); |