!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;
}
// 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);
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -ast-dump -ast-dump-filter AutoVar | FileCheck %s
+
+namespace {
+ class foo {
+ };
+}
+
+#pragma GCC visibility push(hidden)
+auto AutoVar = foo();
+
+// CHECK: VarDecl {{.*}} AutoVar
+// CHECK-NOT: VisibilityAttr