Index: unittests/Bitcode/NaClMungeTest.h |
diff --git a/unittests/Bitcode/NaClMungeTest.h b/unittests/Bitcode/NaClMungeTest.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..52c7d93ddf3b2816e8db28de6cd58883e081d7bc |
--- /dev/null |
+++ b/unittests/Bitcode/NaClMungeTest.h |
@@ -0,0 +1,41 @@ |
+//===- llvm/unittest/Bitcode/NaClMungeTest.h - Test munging utils ---------===// |
+// |
+// The LLVM Compiler Infrastructure |
+// |
+// This file is distributed under the University of Illinois Open Source |
+// License. See LICENSE.TXT for details. |
+// |
+//===----------------------------------------------------------------------===// |
+ |
+// Contains common utilities used in bitcode munge tests. |
+ |
+#ifndef LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |
+#define LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |
+ |
+#include "llvm/ADT/STLExtras.h" |
+#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h" |
+ |
+#include "gtest/gtest.h" |
+ |
+namespace naclmungetest { |
+ |
+const uint64_t Terminator = 0x5768798008978675LL; |
+ |
+#define ARRAY(name) name, array_lengthof(name) |
+ |
+#define ARRAY_TERM(name) ARRAY(name), Terminator |
+ |
+inline std::string stringify(llvm::NaClMungedBitcode &MungedBitcode) { |
+ std::string Buffer; |
+ llvm::raw_string_ostream StrBuf(Buffer); |
+ MungedBitcode.print(StrBuf); |
+ return StrBuf.str(); |
+} |
+ |
+inline std::string stringify(llvm::NaClBitcodeMunger &Munger) { |
+ return stringify(Munger.getMungedBitcode()); |
+} |
+ |
+} // end of namespace naclmungetest |
+ |
+#endif // end LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |