aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-02-08 21:46:50 +0000
committerJohn McCall <rjmccall@apple.com>2010-02-08 21:46:50 +0000
commit88786862424cb2d478516d911709dc19c962af9c (patch)
treedf9886634304098dbc0bca7beb48ef0775de0014 /lib/CodeGen/CodeGenModule.cpp
parentf1904a8a3fceb023e74a8bedc665c5b12415d2ac (diff)
Emit global references with constant initializers as constants. Fixes PR5585.
The standard actually says that such references should have internal linkage, but gcc doesn't do that, so we probably can't get away with it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index c5d84d74db..a6b546ef9e 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -783,7 +783,7 @@ CodeGenModule::CreateRuntimeFunction(const llvm::FunctionType *FTy,
}
static bool DeclIsConstantGlobal(ASTContext &Context, const VarDecl *D) {
- if (!D->getType().isConstant(Context))
+ if (!D->getType().isConstant(Context) && !D->getType()->isReferenceType())
return false;
if (Context.getLangOptions().CPlusPlus &&
Context.getBaseElementType(D->getType())->getAs<RecordType>()) {