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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user