mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-30 18:41:31 +00:00
Make BitcodeReader::parseIdentificationBlock() robust to EOF
This method is particular: it iterates at the top-level and does not have an enclosing block. llvm-svn: 286394
This commit is contained in:
1 parent
d43b7e8d10
commit
67d1a41226
1 file changed
+6
@@ -4347,6 +4347,12 @@ Expected<std::string> BitcodeReader::parseIdentificationBlock() {
|
||||
// We expect a number of well-defined blocks, though we don't necessarily
|
||||
// need to understand them all.
|
||||
while (true) {
|
||||
// This loop iterates at the top-level: since there is no enclosing block
|
||||
// we need to make sure we aren't at the end of the stream before calling
|
||||
// advance, otherwise we'll get an error.
|
||||
if (Stream.AtEndOfStream())
|
||||
return Error::success();
|
||||
|
||||
BitstreamEntry Entry = Stream.advance();
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::Error:
|
||||
|
||||
Reference in new issue
Block a user