[BitcodeReader] Change an assert to a call to a call to Error()
[oota-llvm.git] / lib / Bitcode / Reader / BitcodeReader.cpp
index 441a4c76344a69d3246b8a803a2224444cdce157..4044ac80f20330b3de2a72881f5145269b097b5f 100644 (file)
@@ -1634,9 +1634,9 @@ std::error_code BitcodeReader::ParseMetadata() {
       Record.clear();
       Code = Stream.ReadCode();
 
-      // METADATA_NAME is always followed by METADATA_NAMED_NODE.
       unsigned NextBitCode = Stream.readRecord(Code, Record);
-      assert(NextBitCode == bitc::METADATA_NAMED_NODE); (void)NextBitCode;
+      if (NextBitCode != bitc::METADATA_NAMED_NODE)
+        return Error("METADATA_NAME not followed by METADATA_NAMED_NODE");
 
       // Read named metadata elements.
       unsigned Size = Record.size();