Return from function after storing initializer value.
This commit is contained in:
5
expr.cpp
5
expr.cpp
@@ -596,14 +596,15 @@ InitSymbol(llvm::Value *ptr, const Type *symType, Expr *initExpr,
|
|||||||
return;
|
return;
|
||||||
initExpr = TypeConvertExpr(initExpr, symType, "initializer");
|
initExpr = TypeConvertExpr(initExpr, symType, "initializer");
|
||||||
|
|
||||||
if (initExpr != NULL) {
|
if (initExpr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
llvm::Value *initializerValue = initExpr->GetValue(ctx);
|
llvm::Value *initializerValue = initExpr->GetValue(ctx);
|
||||||
if (initializerValue != NULL)
|
if (initializerValue != NULL)
|
||||||
// Bingo; store the value in the variable's storage
|
// Bingo; store the value in the variable's storage
|
||||||
ctx->StoreInst(initializerValue, ptr);
|
ctx->StoreInst(initializerValue, ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Atomic types and enums can't be initialized with { ... } initializer
|
// Atomic types and enums can't be initialized with { ... } initializer
|
||||||
// expressions, so print an error and return if that's what we've got
|
// expressions, so print an error and return if that's what we've got
|
||||||
|
|||||||
Reference in New Issue
Block a user