Chromium Code Reviews| Index: src/BitcodeMunge.h |
| diff --git a/src/BitcodeMunge.h b/src/BitcodeMunge.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..138a0aded61a6de3e03bfaaea0ad0b0df34c6bd5 |
| --- /dev/null |
| +++ b/src/BitcodeMunge.h |
| @@ -0,0 +1,46 @@ |
| +//===- BitcodeMunge.h - Subzero Bitcode Munger ------------------*- C++ -*-===// |
| +// |
| +// The LLVM Compiler Infrastructure |
| +// |
| +// This file is distributed under the University of Illinois Open Source |
| +// License. See LICENSE.TXT for details. |
| +// |
| +//===----------------------------------------------------------------------===// |
| +// |
| +// Test harness for testing malformed bitcode files in Subzero. Uses NaCl's |
| +// bitcode mangler to do this. |
|
Jim Stichnoth
2015/01/05 23:38:14
mangler or munger?
Karl
2015/01/08 21:35:05
mangler => munger
|
| +// |
| +//===----------------------------------------------------------------------===// |
| + |
| +#ifndef SUBZERO_SRC_BITCODEMUNGE_H |
| +#define SUBZERO_SRC_BITCODEMUNGE_H |
| + |
| +#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h" |
| +namespace IceTest { |
|
Jim Stichnoth
2015/01/05 23:38:14
Add a blank line above?
Karl
2015/01/08 21:35:05
Done.
|
| + |
| +// Class to run tests on subzero's bitcode parser. Runs a subzero |
|
Jim Stichnoth
2015/01/05 23:38:14
Capitalize Subzero
Karl
2015/01/08 21:35:05
Done.
|
| +// translation, using a (possibly) editted array of bicode record |
|
Jim Stichnoth
2015/01/05 23:38:14
edited
bitcode
Karl
2015/01/08 21:35:05
Done.
|
| +// values. For more details on how to represent the input arrays, see |
| +// NaClBitcodeMunge.h. |
| +class SubzeroBitcodeMunger : public llvm::NaClBitcodeMunger { |
| +public: |
| + SubzeroBitcodeMunger(const uint64_t Records[], size_t RecordSize, |
| + uint64_t RecordTerminator) |
| + : llvm::NaClBitcodeMunger(Records, RecordSize, RecordTerminator) {} |
| + |
| + /// Runs PNaClTranslator to translate bitcode records (with defined |
| + /// record Munges), and puts output into DumpResults. Returns true |
| + /// if parse is successful. |
| + bool runTest(const char* TestName, const uint64_t Munges[], |
| + size_t MungeSize); |
| + |
| + /// Same as above, but without any edits. |
| + bool runTest(const char* TestName) { |
| + uint64_t NoMunges[] = {0}; |
| + return runTest(TestName, NoMunges, 0); |
| + } |
| +}; |
| + |
| +} // end of namespace IceTest |
| + |
| +#endif // SUBZERO_SRC_BITCODEMUNGE_H |