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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 << "Uses illegal abbreviation index in define abbreviation record: " | 397 << "Uses illegal abbreviation index in define abbreviation record: " |
398 << Record << "\n"; | 398 << Record << "\n"; |
399 if (!Flags.getTryToRecover()) | 399 if (!Flags.getTryToRecover()) |
400 return false; | 400 return false; |
401 } | 401 } |
402 NaClBitCodeAbbrev *Abbrev = buildAbbrev(Record); | 402 NaClBitCodeAbbrev *Abbrev = buildAbbrev(Record); |
403 if (Abbrev == nullptr) { | 403 if (Abbrev == nullptr) { |
404 markCurrentBlockWithOmittedAbbreviations(); | 404 markCurrentBlockWithOmittedAbbreviations(); |
405 return Flags.getTryToRecover(); | 405 return Flags.getTryToRecover(); |
406 } | 406 } |
| 407 if (atOutermostScope()) { |
| 408 RecoverableError() << "Abbreviation definition not in block: " |
| 409 << Record << "\n"; |
| 410 return Flags.getTryToRecover(); |
| 411 } |
407 if (getCurWriteBlockID() == naclbitc::BLOCKINFO_BLOCK_ID) { | 412 if (getCurWriteBlockID() == naclbitc::BLOCKINFO_BLOCK_ID) { |
408 Writer.EmitBlockInfoAbbrev(SetBID, Abbrev); | 413 Writer.EmitBlockInfoAbbrev(SetBID, Abbrev); |
409 } else { | 414 } else { |
410 Writer.EmitAbbrev(Abbrev); | 415 Writer.EmitAbbrev(Abbrev); |
411 } | 416 } |
412 break; | 417 break; |
413 } | 418 } |
414 case naclbitc::BLK_CODE_HEADER: | 419 case naclbitc::BLK_CODE_HEADER: |
415 // Note: There is no abbreviation index here. Ignore. | 420 // Note: There is no abbreviation index here. Ignore. |
416 for (uint64_t Value : Record.Values) | 421 for (uint64_t Value : Record.Values) |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 NaClWriteHeader(Writer, true); | 604 NaClWriteHeader(Writer, true); |
600 } | 605 } |
601 for (const NaClBitcodeAbbrevRecord &Record : *this) { | 606 for (const NaClBitcodeAbbrevRecord &Record : *this) { |
602 if (!State.emitRecord(Writer, Record)) | 607 if (!State.emitRecord(Writer, Record)) |
603 break; | 608 break; |
604 } | 609 } |
605 bool RecoverSilently = | 610 bool RecoverSilently = |
606 State.Results.NumErrors > 0 && !Flags.getTryToRecover(); | 611 State.Results.NumErrors > 0 && !Flags.getTryToRecover(); |
607 return State.finish(Writer, RecoverSilently); | 612 return State.finish(Writer, RecoverSilently); |
608 } | 613 } |
OLD | NEW |