aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-02-24 19:03:39 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-02-24 19:03:39 +0000
commit094b64336495496ca29bc1e4774f5e2ceed79096 (patch)
treef3129d0515acf48ca3d1b7b54261cb4ea26d0b98 /lib/AST/Decl.cpp
parentc34348a7ef1a6b3f92a644a227953800cd1f9947 (diff)
Likely fix for PR9316 and other unknown bugs: don't use the anonynmous
namespace blanket rule for variables and functions declared 'extern "C"'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126400 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 18c680b1fe..b482a03299 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -266,8 +266,12 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
return LinkageInfo::internal();
}
- if (D->isInAnonymousNamespace())
- return LinkageInfo::uniqueExternal();
+ if (D->isInAnonymousNamespace()) {
+ const VarDecl *Var = dyn_cast<VarDecl>(D);
+ const FunctionDecl *Func = dyn_cast<FunctionDecl>(D);
+ if ((!Var || !Var->isExternC()) && (!Func || !Func->isExternC()))
+ return LinkageInfo::uniqueExternal();
+ }
// Set up the defaults.