| OLD | NEW |
| 1 //===- NaClBitcodeMungeWriter.cpp - Write munged bitcode --------*- C++ -*-===// | 1 //===- NaClBitcodeMungeWriter.cpp - Write munged bitcode --------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // Implements method NaClMungedBitcode.write(), which writes out a munged | 10 // Implements method NaClMungedBitcode.write(), which writes out a munged |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 RecoverableError() << "Ignoring abbreviation: " << Record << "\n"; | 370 RecoverableError() << "Ignoring abbreviation: " << Record << "\n"; |
| 371 return Flags.getTryToRecover(); | 371 return Flags.getTryToRecover(); |
| 372 } | 372 } |
| 373 if (Record.Abbrev != naclbitc::DEFINE_ABBREV) { | 373 if (Record.Abbrev != naclbitc::DEFINE_ABBREV) { |
| 374 RecoverableError() | 374 RecoverableError() |
| 375 << "Uses illegal abbreviation index in define abbreviation record: " | 375 << "Uses illegal abbreviation index in define abbreviation record: " |
| 376 << Record << "\n"; | 376 << Record << "\n"; |
| 377 if (!Flags.getTryToRecover()) | 377 if (!Flags.getTryToRecover()) |
| 378 return false; | 378 return false; |
| 379 } | 379 } |
| 380 if (atOutermostScope()) { |
| 381 // Recover by ignoring abbreviation definition. |
| 382 RecoverableError() << "Defining abbreviation outside block: " |
| 383 << Record << "\n"; |
| 384 return Flags.getTryToRecover(); |
| 385 } |
| 380 NaClBitCodeAbbrev *Abbrev = buildAbbrev(Record); | 386 NaClBitCodeAbbrev *Abbrev = buildAbbrev(Record); |
| 381 if (Abbrev == nullptr) { | 387 if (Abbrev == nullptr) { |
| 382 markCurrentBlockWithOmittedAbbreviations(); | 388 markCurrentBlockWithOmittedAbbreviations(); |
| 383 return Flags.getTryToRecover(); | 389 return Flags.getTryToRecover(); |
| 384 } | 390 } |
| 385 if (getCurWriteBlockID() == naclbitc::BLOCKINFO_BLOCK_ID) { | 391 if (getCurWriteBlockID() == naclbitc::BLOCKINFO_BLOCK_ID) { |
| 386 Writer.EmitBlockInfoAbbrev(SetBID, Abbrev); | 392 Writer.EmitBlockInfoAbbrev(SetBID, Abbrev); |
| 387 } else { | 393 } else { |
| 388 Writer.EmitAbbrev(Abbrev); | 394 Writer.EmitAbbrev(Abbrev); |
| 389 } | 395 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 NaClWriteHeader(Writer, true); | 568 NaClWriteHeader(Writer, true); |
| 563 } | 569 } |
| 564 for (const NaClBitcodeAbbrevRecord &Record : *this) { | 570 for (const NaClBitcodeAbbrevRecord &Record : *this) { |
| 565 if (!State.emitRecord(Writer, Record)) | 571 if (!State.emitRecord(Writer, Record)) |
| 566 break; | 572 break; |
| 567 } | 573 } |
| 568 bool RecoverSilently = | 574 bool RecoverSilently = |
| 569 State.Results.NumErrors > 0 && !Flags.getTryToRecover(); | 575 State.Results.NumErrors > 0 && !Flags.getTryToRecover(); |
| 570 return State.finish(Writer, RecoverSilently); | 576 return State.finish(Writer, RecoverSilently); |
| 571 } | 577 } |
| OLD | NEW |