OLD | NEW |
1 //===- llvm/unittest/Bitcode/NaClMungeTest.h - Test munging utils ---------===// | 1 //===- llvm/unittest/Bitcode/NaClMungeTest.h - Test munging utils ---------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 // Contains common utilities used in bitcode munge tests. | 10 // Contains common utilities used in bitcode munge tests. |
11 | 11 |
12 #ifndef LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H | 12 #ifndef LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |
13 #define LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H | 13 #define LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |
14 | 14 |
15 #include "llvm/ADT/STLExtras.h" | 15 #include "llvm/ADT/STLExtras.h" |
16 #include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h" | 16 #include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h" |
17 | 17 |
18 #include "gtest/gtest.h" | 18 #include "gtest/gtest.h" |
19 | 19 |
20 namespace naclmungetest { | 20 namespace naclmungetest { |
21 | 21 |
22 const uint64_t Terminator = 0x5768798008978675LL; | 22 const uint64_t Terminator = 0x5768798008978675LL; |
23 | 23 |
24 #define ARRAY(name) name, array_lengthof(name) | 24 #define ARRAY(name) name, array_lengthof(name) |
25 | 25 |
26 #define ARRAY_TERM(name) ARRAY(name), Terminator | 26 #define ARRAY_TERM(name) ARRAY(name), Terminator |
27 | 27 |
| 28 // Removes error severity prefices, if present, for each line in the message. |
| 29 // Returns the stripped result. |
| 30 std::string stripErrorPrefix(const std::string &Message); |
| 31 |
28 inline std::string stringify(llvm::NaClMungedBitcode &MungedBitcode) { | 32 inline std::string stringify(llvm::NaClMungedBitcode &MungedBitcode) { |
29 std::string Buffer; | 33 std::string Buffer; |
30 llvm::raw_string_ostream StrBuf(Buffer); | 34 llvm::raw_string_ostream StrBuf(Buffer); |
31 MungedBitcode.print(StrBuf); | 35 MungedBitcode.print(StrBuf); |
32 return StrBuf.str(); | 36 return StrBuf.str(); |
33 } | 37 } |
34 | 38 |
35 inline std::string stringify(llvm::NaClBitcodeMunger &Munger) { | 39 inline std::string stringify(llvm::NaClBitcodeMunger &Munger) { |
36 return stringify(Munger.getMungedBitcode()); | 40 return stringify(Munger.getMungedBitcode()); |
37 } | 41 } |
38 | 42 |
39 } // end of namespace naclmungetest | 43 } // end of namespace naclmungetest |
40 | 44 |
41 #endif // end LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H | 45 #endif // end LLVM_UNITTEST_BITCODE_NACLMUNGETEST_H |
OLD | NEW |