Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1437)

Side by Side Diff: lib/Bitcode/NaCl/Reader/NaClBitcodeParser.cpp

Issue 986453002: Additional clean ups on errors in bitcode parsing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix comment. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- NaClBitcodeParser.cpp ----------------------------------------------===// 1 //===- NaClBitcodeParser.cpp ----------------------------------------------===//
2 // Low-level bitcode driver to parse PNaCl bitcode files. 2 // Low-level bitcode driver to parse PNaCl bitcode files.
3 // 3 //
4 // The LLVM Compiler Infrastructure 4 // The LLVM Compiler Infrastructure
5 // 5 //
6 // This file is distributed under the University of Illinois Open Source 6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details. 7 // License. See LICENSE.TXT for details.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Parser->ProcessAbbreviation(IsLocal ? Parser->GetBlockID() : GlobalBlockID, 79 Parser->ProcessAbbreviation(IsLocal ? Parser->GetBlockID() : GlobalBlockID,
80 Abbrev, IsLocal); 80 Abbrev, IsLocal);
81 } 81 }
82 82
83 NaClBitcodeParser::~NaClBitcodeParser() { 83 NaClBitcodeParser::~NaClBitcodeParser() {
84 if (EnclosingParser) { 84 if (EnclosingParser) {
85 EnclosingParser->Block.LocalStartBit += Block.GetNumBits(); 85 EnclosingParser->Block.LocalStartBit += Block.GetNumBits();
86 } 86 }
87 } 87 }
88 88
89 bool NaClBitcodeParser::ErrorAt(uint64_t BitPosition, 89 bool NaClBitcodeParser::ErrorAt(
90 const std::string &Message) { 90 naclbitc::ErrorLevel Level, uint64_t BitPosition,
91 *ErrStream << "Error(" << NaClBitstreamReader::getBitAddress(BitPosition, 1) 91 const std::string &Message) {
92 << "): " << Message << "\n"; 92 naclbitc::ErrorAt(*ErrStream, Level, BitPosition) << Message << "\n";
93 if (Level == naclbitc::Fatal)
94 report_fatal_error("Unable to continue");
93 return true; 95 return true;
94 } 96 }
95 97
96 void NaClBitcodeParser::FatalAt(uint64_t BitPosition,
97 const std::string &Message) {
98 ErrorAt(BitPosition, Message);
99 report_fatal_error("Unable to continue");
100 }
101
102 bool NaClBitcodeParser::Parse() { 98 bool NaClBitcodeParser::Parse() {
103 Record.ReadEntry(); 99 Record.ReadEntry();
104 100
105 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) 101 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock)
106 return Error("Expected block, but not found"); 102 return Error("Expected block, but not found");
107 103
108 return ParseBlock(Record.GetEntryID()); 104 return ParseBlock(Record.GetEntryID());
109 } 105 }
110 106
111 bool NaClBitcodeParser::ParseBlockInfoInternal() { 107 bool NaClBitcodeParser::ParseBlockInfoInternal() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } else { 150 } else {
155 // Read in a record. 151 // Read in a record.
156 Record.ReadValues(); 152 Record.ReadValues();
157 ProcessRecord(); 153 ProcessRecord();
158 } 154 }
159 break; 155 break;
160 } 156 }
161 } 157 }
162 return false; 158 return false;
163 } 159 }
OLDNEW
« no previous file with comments | « lib/Bitcode/NaCl/Analysis/NaClObjDumpStream.cpp ('k') | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698