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

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

Issue 932953002: Fix the NaCl bitstream reader to report fatal errors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Merge with master 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
« no previous file with comments | « lib/Bitcode/NaCl/Reader/NaClBitCodes.cpp ('k') | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
90 const std::string &Message) {
91 *ErrStream << "Error(" << NaClBitstreamReader::getBitAddress(BitPosition, 1)
92 << "): " << Message << "\n";
93 return true;
94 }
95
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
89 bool NaClBitcodeParser::Parse() { 102 bool NaClBitcodeParser::Parse() {
90 Record.ReadEntry(); 103 Record.ReadEntry();
91 104
92 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) 105 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock)
93 return Error("Expected block, but not found"); 106 return Error("Expected block, but not found");
94 107
95 return ParseBlock(Record.GetEntryID()); 108 return ParseBlock(Record.GetEntryID());
96 } 109 }
97 110
98 bool NaClBitcodeParser::ParseBlockInfoInternal() { 111 bool NaClBitcodeParser::ParseBlockInfoInternal() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } else { 155 } else {
143 // Read in a record. 156 // Read in a record.
144 Record.ReadValues(); 157 Record.ReadValues();
145 ProcessRecord(); 158 ProcessRecord();
146 } 159 }
147 break; 160 break;
148 } 161 }
149 } 162 }
150 return false; 163 return false;
151 } 164 }
OLDNEW
« no previous file with comments | « lib/Bitcode/NaCl/Reader/NaClBitCodes.cpp ('k') | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698