From: Eli Friedman Date: Thu, 26 Nov 2009 03:04:01 +0000 (+0000) Subject: Slight tweak to the algorithm for getLinkage(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e9d6554ba78fb81e810fdaec9b2c98ab96526e83;p=clang Slight tweak to the algorithm for getLinkage(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89932 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index b52c7ada7f..572d76ff72 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -232,7 +232,7 @@ static NamedDecl::Linkage getLinkageForNamespaceScopeDecl(const NamedDecl *D) { // declared to have external linkage; or // (there is no equivalent in C99) if (Context.getLangOptions().CPlusPlus && - Var->getType().isConstQualified() && + Var->getType().isConstant(Context) && Var->getStorageClass() != VarDecl::Extern && Var->getStorageClass() != VarDecl::PrivateExtern) { bool FoundExtern = false; diff --git a/test/CodeGenCXX/const-global-linkage.cpp b/test/CodeGenCXX/const-global-linkage.cpp index ddf435823b..f12c569d94 100644 --- a/test/CodeGenCXX/const-global-linkage.cpp +++ b/test/CodeGenCXX/const-global-linkage.cpp @@ -6,3 +6,8 @@ const int y = 20; // CHECK: @y = internal constant i32 20 const int& b() { return y; } +const char z1[] = "asdf"; +const char z2[] = "zxcv"; +// CHECK-NOT: @z1 +// CHECK: @z2 = internal constant +const char* b2() { return z2; }