From: Filipe Cabecinhas Date: Wed, 29 Apr 2015 02:36:08 +0000 (+0000) Subject: Use an "early return" idiom for the error case. NFC X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fe8aabd453fa0f791c78e772a602f91ae153ce2;p=platform%2Fupstream%2Fllvm.git Use an "early return" idiom for the error case. NFC llvm-svn: 236080 --- diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index f11eba5..b76b134 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1475,20 +1475,18 @@ std::error_code BitcodeReader::ParseTypeTableBody() { case bitc::TYPE_CODE_ARRAY: // ARRAY: [numelts, eltty] if (Record.size() < 2) return Error("Invalid record"); - if ((ResultTy = getTypeByID(Record[1])) && - ArrayType::isValidElementType(ResultTy)) - ResultTy = ArrayType::get(ResultTy, Record[0]); - else + ResultTy = getTypeByID(Record[1]); + if (!ResultTy || !ArrayType::isValidElementType(ResultTy)) return Error("Invalid type"); + ResultTy = ArrayType::get(ResultTy, Record[0]); break; case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty] if (Record.size() < 2) return Error("Invalid record"); - if ((ResultTy = getTypeByID(Record[1])) && - StructType::isValidElementType(ResultTy)) - ResultTy = VectorType::get(ResultTy, Record[0]); - else + ResultTy = getTypeByID(Record[1]); + if (!ResultTy || !StructType::isValidElementType(ResultTy)) return Error("Invalid type"); + ResultTy = VectorType::get(ResultTy, Record[0]); break; }