Chromium Code Reviews| 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. |