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

Side by Side Diff: include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h

Issue 1310883003: Install notion of diagnostic handler into PNaCl bitcode readers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix issues in patch set 2. Created 5 years, 3 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 | « no previous file | include/llvm/Bitcode/NaCl/NaClReaderWriter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- NaClBitcodeMunge.h - Bitcode Munger ----------------------*- C++ -*-===// 1 //===- NaClBitcodeMunge.h - Bitcode Munger ----------------------*- 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 // Test harness for generating a PNaCl bitcode memory buffer from 10 // Test harness for generating a PNaCl bitcode memory buffer from
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SmallVector<char, 1024> MungedInputBuffer; 143 SmallVector<char, 1024> MungedInputBuffer;
144 /// The write flags to use when writing bitcode. 144 /// The write flags to use when writing bitcode.
145 NaClMungedBitcode::WriteFlags WriteFlags; 145 NaClMungedBitcode::WriteFlags WriteFlags;
146 // Flag to redirect dump stream if running death test. 146 // Flag to redirect dump stream if running death test.
147 bool RunAsDeathTest; 147 bool RunAsDeathTest;
148 148
149 // Records that an error occurred, and returns stream to print error 149 // Records that an error occurred, and returns stream to print error
150 // message to. 150 // message to.
151 raw_ostream &Error() { 151 raw_ostream &Error() {
152 FoundErrors = true; 152 FoundErrors = true;
153 return getDumpStream() << "Error: "; 153 return getDumpStream() << "error: ";
154 } 154 }
155 155
156 // Returns the lines containing the given Substring, from the string 156 // Returns the lines containing the given Substring, from the string
157 // getTestResults(). If MustBePrefix, then Substring must match at 157 // getTestResults(). If MustBePrefix, then Substring must match at
158 // the beginning of the line. 158 // the beginning of the line.
159 std::string getLinesWithTextMatch(const std::string &Substring, 159 std::string getLinesWithTextMatch(const std::string &Substring,
160 bool MustBePrefix = false) const; 160 bool MustBePrefix = false) const;
161 161
162 // Returns the log stream to use. When running death tests, redirect output 162 // Returns the log stream to use. When running death tests, redirect output
163 // to the error stream (rather than buffering in DumpStream), so that 163 // to the error stream (rather than buffering in DumpStream), so that
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 // Class to run tests for function NaClParseBitcodeFile. 268 // Class to run tests for function NaClParseBitcodeFile.
269 class NaClParseBitcodeMunger : public NaClBitcodeMunger { 269 class NaClParseBitcodeMunger : public NaClBitcodeMunger {
270 public: 270 public:
271 NaClParseBitcodeMunger(const uint64_t Records[], size_t RecordsSize, 271 NaClParseBitcodeMunger(const uint64_t Records[], size_t RecordsSize,
272 uint64_t RecordTerminator) 272 uint64_t RecordTerminator)
273 : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator) {} 273 : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator) {}
274 274
275 /// Runs function llvm::NaClParseBitcodeFile, and puts error messages 275 /// Runs function llvm::NaClParseBitcodeFile, and puts error messages
276 /// into DumpResults. Returns true if parse is successful. 276 /// into DumpResults. Returns true if parse is successful.
277 bool runTest(const uint64_t Munges[], size_t MungesSize, bool VerboseErrors); 277 /// TODO(kschimpf) Remove VerboseErrors, no longer useful.
278 bool runTest(const uint64_t Munges[], size_t MungesSize,
279 bool VerboseErrors = false);
278 280
279 // Same as above, but without any edits. 281 // Same as above, but without any edits.
280 bool runTest(bool VerboseErrors) { 282 /// TODO(kschimpf) Remove VerboseErrors, no longer useful.
283 bool runTest(bool VerboseErrors = false) {
281 uint64_t NoMunges[] = {0}; 284 uint64_t NoMunges[] = {0};
282 return runTest(NoMunges, 0, VerboseErrors); 285 return runTest(NoMunges, 0, VerboseErrors);
283 } 286 }
284 }; 287 };
285 288
286 // Class to run tests for NaClBitcodeCompressor.compress(). 289 // Class to run tests for NaClBitcodeCompressor.compress().
287 class NaClCompressMunger : public NaClBitcodeMunger { 290 class NaClCompressMunger : public NaClBitcodeMunger {
288 public: 291 public:
289 NaClCompressMunger(const uint64_t Records[], size_t RecordsSize, 292 NaClCompressMunger(const uint64_t Records[], size_t RecordsSize,
290 uint64_t RecordTerminator) 293 uint64_t RecordTerminator)
291 : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator) {} 294 : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator) {}
292 295
293 bool runTest(const uint64_t Munges[], size_t MungesSize); 296 bool runTest(const uint64_t Munges[], size_t MungesSize);
294 297
295 bool runTest() { 298 bool runTest() {
296 uint64_t NoMunges[] = {0}; 299 uint64_t NoMunges[] = {0};
297 return runTest(NoMunges, 0); 300 return runTest(NoMunges, 0);
298 } 301 }
299 }; 302 };
300 303
301 } // end namespace llvm. 304 } // end namespace llvm.
302 305
303 #endif // LLVM_BITCODE_NACL_NACLBITCODEMUNGE_H 306 #endif // LLVM_BITCODE_NACL_NACLBITCODEMUNGE_H
OLDNEW
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClReaderWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698