Initialize the Init variable to something reasonable when we emit an

error, so we don't crash.

llvm-svn: 65099
This commit is contained in:
Eli Friedman
2009-02-20 01:18:21 +00:00
parent 742421e2e7
commit 719ed1a9ab

View File

@@ -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();