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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h

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: Fix issues raised in patch set 8. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitcodeParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h b/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
index 2281a222a8a43fb8db1cc39fd3196db69bc92031..14c886b12cc6e9c4ead4898ee446083136f32c54 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
@@ -139,6 +139,8 @@ protected:
std::string FatalBuffer;
// The stream to write the fatal message to.
raw_string_ostream FatalStream;
+ // The stack of maximum abbreviation indices allowed by block enter record.
+ std::vector<uint64_t> AbbrevIndexLimitStack;
jvoung (off chromium) 2015/02/23 22:57:38 Might be able to just use a SmallVector, if typica
Karl 2015/02/23 23:09:01 Good point. It shouldn't get deeper than 3 levels.
// Records that an error occurred, and returns stream to print error
// message to.
@@ -197,7 +199,8 @@ public:
/// Creates a bitcode munger, based on the given array of values.
NaClObjDumpMunger(const uint64_t Records[], size_t RecordsSize,
uint64_t RecordTerminator)
- : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator) {}
+ : NaClBitcodeMunger(Records, RecordsSize, RecordTerminator),
+ RunAsDeathTest(false) {}
/// Runs function NaClObjDump on the sequence of records associated
/// with the instance. The memory buffer containing the bitsequence
@@ -215,6 +218,18 @@ public:
NoAssembly);
}
+ /// Returns true if running as death test.
+ bool getRunAsDeathTest() const {
+ return RunAsDeathTest;
+ }
+
+ /// Sets death test flag. When true, output will be redirected to
+ /// the errs() (rather than buffered) so that the test can be
+ /// debugged.
+ void setRunAsDeathTest(bool NewValue) {
+ RunAsDeathTest = NewValue;
+ }
+
/// Same as above except it runs function NaClObjDump with flags
/// NoRecords and NoAssembly set to false, and AddHeader set to true.
bool runTest(const char *TestName) {
@@ -260,6 +275,11 @@ public:
size_t MungesSize) {
return runTestWithFlags(TestName, Munges, MungesSize, true, true, true);
}
+
+private:
+ // Flag to redirect dump stream if running death test.
+ bool RunAsDeathTest;
+
};
// Class to run tests for function NaClParseBitcodeFile.
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitcodeParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698