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

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: Merge with master 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 03438e39c67308b7abd73dc45f1a71df4b699bab..31a5c4733636811b5e2828cf94fe335751303898 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.
+ SmallVector<uint64_t, 3> AbbrevIndexLimitStack;
// 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