From ce82c3c0aed94828a42078c7a86972e97916e12f Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 5 Mar 2012 09:13:13 -0800 Subject: [PATCH] Return from function after storing initializer value. --- expr.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/expr.cpp b/expr.cpp index 890e664a..7b47cda2 100644 --- a/expr.cpp +++ b/expr.cpp @@ -596,13 +596,14 @@ InitSymbol(llvm::Value *ptr, const Type *symType, Expr *initExpr, return; initExpr = TypeConvertExpr(initExpr, symType, "initializer"); - if (initExpr != NULL) { - llvm::Value *initializerValue = initExpr->GetValue(ctx); - if (initializerValue != NULL) - // Bingo; store the value in the variable's storage - ctx->StoreInst(initializerValue, ptr); + if (initExpr == NULL) return; - } + + llvm::Value *initializerValue = initExpr->GetValue(ctx); + if (initializerValue != NULL) + // Bingo; store the value in the variable's storage + ctx->StoreInst(initializerValue, ptr); + return; } // Atomic types and enums can't be initialized with { ... } initializer