Use an "early return" idiom for the error case. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Filipe Cabecinhas 2015-04-29 02:36:08 +00:00
parent 99ebc9e004
commit fe7b873743

View File

@ -1475,20 +1475,18 @@ std::error_code BitcodeReader::ParseTypeTableBody() {
case bitc::TYPE_CODE_ARRAY: // ARRAY: [numelts, eltty] case bitc::TYPE_CODE_ARRAY: // ARRAY: [numelts, eltty]
if (Record.size() < 2) if (Record.size() < 2)
return Error("Invalid record"); return Error("Invalid record");
if ((ResultTy = getTypeByID(Record[1])) && ResultTy = getTypeByID(Record[1]);
ArrayType::isValidElementType(ResultTy)) if (!ResultTy || !ArrayType::isValidElementType(ResultTy))
ResultTy = ArrayType::get(ResultTy, Record[0]);
else
return Error("Invalid type"); return Error("Invalid type");
ResultTy = ArrayType::get(ResultTy, Record[0]);
break; break;
case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty] case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty]
if (Record.size() < 2) if (Record.size() < 2)
return Error("Invalid record"); return Error("Invalid record");
if ((ResultTy = getTypeByID(Record[1])) && ResultTy = getTypeByID(Record[1]);
StructType::isValidElementType(ResultTy)) if (!ResultTy || !StructType::isValidElementType(ResultTy))
ResultTy = VectorType::get(ResultTy, Record[0]);
else
return Error("Invalid type"); return Error("Invalid type");
ResultTy = VectorType::get(ResultTy, Record[0]);
break; break;
} }