Check ConsiderGlobalVisibility before using -fvisibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155100 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 7db38a9..f26747b 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -291,7 +291,8 @@
     }
   }
 
-  LV.mergeVisibility(Context.getLangOpts().getVisibilityMode());
+  if (F.ConsiderGlobalVisibility)
+    LV.mergeVisibility(Context.getLangOpts().getVisibilityMode());
 
   // C++ [basic.link]p4:
 
@@ -532,7 +533,8 @@
   if (LV.linkage() == UniqueExternalLinkage)
     return LinkageInfo::uniqueExternal();
 
-  LV.mergeVisibility(D->getASTContext().getLangOpts().getVisibilityMode());
+  if (F.ConsiderGlobalVisibility)
+    LV.mergeVisibility(D->getASTContext().getLangOpts().getVisibilityMode());
 
   if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
     // If the type of the function uses a type with unique-external