| OLD | NEW |
| 1 //===- llvm/unittest/Bitcode/NaClObjDumpTest.cpp -------------------------===// | 1 //===- llvm/unittest/Bitcode/NaClObjDumpTest.cpp -------------------------===// |
| 2 // Tests objdump stream for PNaCl bitcode. | 2 // Tests objdump stream for PNaCl bitcode. |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Runs some simple assembly examples against the given bitcode | 35 // Runs some simple assembly examples against the given bitcode |
| 36 // record, using an objdump stream. | 36 // record, using an objdump stream. |
| 37 static void RunAssemblyExamples( | 37 static void RunAssemblyExamples( |
| 38 ObjDumpStream &Stream, uint64_t Bit, | 38 ObjDumpStream &Stream, uint64_t Bit, |
| 39 const NaClBitcodeRecordData *Record, | 39 const NaClBitcodeRecordData *Record, |
| 40 int32_t AbbrevIndex, | 40 int32_t AbbrevIndex, |
| 41 bool AddErrors) { | 41 bool AddErrors) { |
| 42 | 42 |
| 43 // First assume no assembly. | 43 // First assume no assembly. |
| 44 if (AddErrors) | 44 if (AddErrors) |
| 45 Stream.Error(Bit) << "This is an error\n"; | 45 Stream.ErrorAt(Bit) << "This is an error\n"; |
| 46 Write(Stream, Bit, Record, AbbrevIndex); | 46 Write(Stream, Bit, Record, AbbrevIndex); |
| 47 // Increment bit to new fictitious address, assuming Record takes 21 bits. | 47 // Increment bit to new fictitious address, assuming Record takes 21 bits. |
| 48 Bit += 21; | 48 Bit += 21; |
| 49 | 49 |
| 50 // Now a single line assembly. | 50 // Now a single line assembly. |
| 51 if (AddErrors) | 51 if (AddErrors) |
| 52 Stream.Error(Bit) << "Oops, an error!\n"; | 52 Stream.ErrorAt(Bit) << "Oops, an error!\n"; |
| 53 Stream.Assembly() << "One line assembly."; | 53 Stream.Assembly() << "One line assembly."; |
| 54 Write(Stream, Bit, Record, AbbrevIndex); | 54 Write(Stream, Bit, Record, AbbrevIndex); |
| 55 // Increment bit to new fictitious address, assuming Record takes 17 bits. | 55 // Increment bit to new fictitious address, assuming Record takes 17 bits. |
| 56 Bit += 17; | 56 Bit += 17; |
| 57 | 57 |
| 58 // Now multiple line assembly. | 58 // Now multiple line assembly. |
| 59 if (AddErrors) | 59 if (AddErrors) |
| 60 Stream.Error(Bit) << "The record looks bad\n"; | 60 Stream.ErrorAt(Bit) << "The record looks bad\n"; |
| 61 Stream.Assembly() << "Two Line\nexample assembly."; | 61 Stream.Assembly() << "Two Line\nexample assembly."; |
| 62 if (AddErrors) | 62 if (AddErrors) |
| 63 Stream.Error(Bit) << "Actually, it looks really bad\n"; | 63 Stream.ErrorAt(Bit) << "Actually, it looks really bad\n"; |
| 64 Write(Stream, Bit, Record, AbbrevIndex); | 64 Write(Stream, Bit, Record, AbbrevIndex); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Runs some simple assembly examples against the given bitcode record | 67 // Runs some simple assembly examples against the given bitcode record |
| 68 // using an objdump stream. Adds a message describing the test | 68 // using an objdump stream. Adds a message describing the test |
| 69 // and the record indent being used. | 69 // and the record indent being used. |
| 70 static std::string RunIndentedAssemblyWithAbbrevTest( | 70 static std::string RunIndentedAssemblyWithAbbrevTest( |
| 71 bool DumpRecords, bool DumpAssembly, | 71 bool DumpRecords, bool DumpAssembly, |
| 72 unsigned NumRecordIndents, uint64_t Bit, | 72 unsigned NumRecordIndents, uint64_t Bit, |
| 73 const NaClBitcodeRecordData *Record, int32_t AbbrevIndex, bool AddErrors) { | 73 const NaClBitcodeRecordData *Record, int32_t AbbrevIndex, bool AddErrors) { |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 RunIndentedAssemblyWithAbbrevTest(false, false, 1, 64564, &Record, | 780 RunIndentedAssemblyWithAbbrevTest(false, false, 1, 64564, &Record, |
| 781 naclbitc::UNABBREV_RECORD, false)); | 781 naclbitc::UNABBREV_RECORD, false)); |
| 782 | 782 |
| 783 EXPECT_EQ( | 783 EXPECT_EQ( |
| 784 "", | 784 "", |
| 785 RunIndentedAssemblyWithAbbrevTest(false, false, 2, 64564, &Record, | 785 RunIndentedAssemblyWithAbbrevTest(false, false, 2, 64564, &Record, |
| 786 naclbitc::UNABBREV_RECORD, false)); | 786 naclbitc::UNABBREV_RECORD, false)); |
| 787 } | 787 } |
| 788 | 788 |
| 789 } | 789 } |
| OLD | NEW |