Process #pragma visibility early in the parsing of class definitions. Fixes
pr13338.

llvm-svn: 160105
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index dfe2882..4745376 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8919,6 +8919,10 @@
   PushDeclContext(S, Tag);
 
   ActOnDocumentableDecl(TagD);
+
+  // If there's a #pragma GCC visibility in scope, set the visibility of this
+  // record.
+  AddPushedVisibilityAttribute(Tag);
 }
 
 Decl *Sema::ActOnObjCContainerStartDefinition(Decl *IDecl) {
@@ -8983,10 +8987,6 @@
   if (isa<CXXRecordDecl>(Tag))
     FieldCollector->FinishClass();
 
-  // If there's a #pragma GCC visibility in scope, and this isn't a subclass,
-  // set the visibility of this record.
-  AddPushedVisibilityAttribute(Tag);
-
   // Exit this scope of this tag's definition.
   PopDeclContext();