summaryrefslogtreecommitdiffstats
path: root/clang/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
commit340aafaac6c2291ece78d1c31a00ddfccf71ddd3 (patch)
tree95481d964a64c0cbbaec97cdf5ecf06ae92f89e4 /clang/lib/CodeGen/CodeGenModule.cpp
parentd0450d90b3675a090d7cf657772b8b9924b24352 (diff)
downloadbcm5719-llvm-340aafaac6c2291ece78d1c31a00ddfccf71ddd3.tar.gz
bcm5719-llvm-340aafaac6c2291ece78d1c31a00ddfccf71ddd3.zip
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. llvm-svn: 95577
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index c5d84d74db8..a6b546ef9ef 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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>()) {
OpenPOWER on IntegriCloud