[llvm] r236080 - Use an "early return" idiom for the error case. NFC
Filipe Cabecinhas
me at filcab.net
Tue Apr 28 19:36:08 PDT 2015
Author: filcab
Date: Tue Apr 28 21:36:08 2015
New Revision: 236080
URL: http://llvm.org/viewvc/llvm-project?rev=236080&view=rev
Log:
Use an "early return" idiom for the error case. NFC
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=236080&r1=236079&r2=236080&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Apr 28 21:36:08 2015
@@ -1475,20 +1475,18 @@ std::error_code BitcodeReader::ParseType
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;
}
More information about the llvm-commits
mailing list