aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-02-20 01:18:21 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-02-20 01:18:21 +0000
commit6e656f45ae04b415ba7a4c0c25e55633e2d0ecd0 (patch)
tree7695c17999207927125f330b24ba4d18d94c127f /lib/CodeGen/CodeGenModule.cpp
parentbe26570e3faa009bdcefedfaf04473e518940520 (diff)
Initialize the Init variable to something reasonable when we emit an
error, so we don't crash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 3d01770cd3..7432b01e25 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -626,8 +626,11 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
Init = llvm::Constant::getNullValue(InitTy);
} else {
Init = EmitConstantExpr(D->getInit());
- if (!Init)
+ if (!Init) {
ErrorUnsupported(D, "static initializer");
+ QualType T = D->getInit()->getType();
+ Init = llvm::UndefValue::get(getTypes().ConvertType(T));
+ }
}
const llvm::Type* InitType = Init->getType();