| OLD | NEW |
| 1 //===-- NaClObjDump.cpp - Dump PNaCl bitcode contents ---------------------===// | 1 //===-- NaClObjDump.cpp - Dump PNaCl bitcode contents ---------------------===// |
| 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 #include "llvm/ADT/STLExtras.h" | 10 #include "llvm/ADT/STLExtras.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // Be sure to flush any remaining errors. | 582 // Be sure to flush any remaining errors. |
| 583 ObjDump.Flush(); | 583 ObjDump.Flush(); |
| 584 } | 584 } |
| 585 | 585 |
| 586 // Returns the number of errors that were sent to the ObjDump. | 586 // Returns the number of errors that were sent to the ObjDump. |
| 587 unsigned GetNumErrors() { | 587 unsigned GetNumErrors() { |
| 588 return ObjDump.GetNumErrors(); | 588 return ObjDump.GetNumErrors(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 /// Generates an error with the given message. | 591 /// Generates an error with the given message. |
| 592 bool ErrorAt(uint64_t Bit, const std::string &Message) final { | 592 bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, |
| 593 // Use local error routine so that all errors are treated uniformly. | 593 const std::string &Message) final { |
| 594 ObjDump.Error(Bit) << Message << "\n"; | 594 ObjDump.ErrorAt(Level, Bit) << Message << "\n"; |
| 595 if (Level == naclbitc::Fatal) |
| 596 ObjDump.FlushThenQuit(); |
| 595 return true; | 597 return true; |
| 596 } | 598 } |
| 597 | 599 |
| 598 /// Flushes out objdump and then exits with fatal error. | |
| 599 LLVM_ATTRIBUTE_NORETURN | |
| 600 void Fatal() { | |
| 601 NaClBitcodeParser::Fatal(); | |
| 602 } | |
| 603 | |
| 604 /// Flushes out objdump and then exits with fatal error, using | |
| 605 /// the given message. | |
| 606 LLVM_ATTRIBUTE_NORETURN | |
| 607 void FatalAt(uint64_t Bit, const std::string &Message) final { | |
| 608 ObjDump.Fatal(Bit, Message); | |
| 609 } | |
| 610 | |
| 611 /// Parses the top-level module block. | 600 /// Parses the top-level module block. |
| 612 bool ParseBlock(unsigned BlockID) override; | 601 bool ParseBlock(unsigned BlockID) override; |
| 613 | 602 |
| 614 /// Installs the given type to the next available type index. | 603 /// Installs the given type to the next available type index. |
| 615 void InstallType(Type *Ty) { | 604 void InstallType(Type *Ty) { |
| 616 TypeIdType.push_back(Ty); | 605 TypeIdType.push_back(Ty); |
| 617 } | 606 } |
| 618 | 607 |
| 619 /// Returns the type associated with the given type index. | 608 /// Returns the type associated with the given type index. |
| 620 Type *GetType(uint32_t Index) { | 609 Type *GetType(uint32_t Index) { |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 } | 1347 } |
| 1359 | 1348 |
| 1360 raw_ostream &Errors() { | 1349 raw_ostream &Errors() { |
| 1361 return Context->Errors(); | 1350 return Context->Errors(); |
| 1362 } | 1351 } |
| 1363 | 1352 |
| 1364 raw_ostream &Warnings() { | 1353 raw_ostream &Warnings() { |
| 1365 return Context->Warnings(); | 1354 return Context->Warnings(); |
| 1366 } | 1355 } |
| 1367 | 1356 |
| 1368 void Fatal() { | 1357 bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, |
| 1369 return Context->Fatal(); | 1358 const std::string &Message) final { |
| 1370 } | 1359 return Context->ErrorAt(Level, Bit, Message); |
| 1371 | |
| 1372 void FatalAt(uint64_t Bit, const std::string &Message) override { | |
| 1373 return Context->FatalAt(Bit, Message); | |
| 1374 } | 1360 } |
| 1375 | 1361 |
| 1376 const std::string &GetAssemblyIndent() const { | 1362 const std::string &GetAssemblyIndent() const { |
| 1377 return Context->GetAssemblyIndent(); | 1363 return Context->GetAssemblyIndent(); |
| 1378 } | 1364 } |
| 1379 | 1365 |
| 1380 unsigned GetAssemblyNumTabs() const { | 1366 unsigned GetAssemblyNumTabs() const { |
| 1381 return Context->GetAssemblyNumTabs(); | 1367 return Context->GetAssemblyNumTabs(); |
| 1382 } | 1368 } |
| 1383 | 1369 |
| (...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3572 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" | 3558 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" |
| 3573 << NumBlocksRead << "\n"; | 3559 << NumBlocksRead << "\n"; |
| 3574 ErrorsFound = true; | 3560 ErrorsFound = true; |
| 3575 } | 3561 } |
| 3576 | 3562 |
| 3577 ObjDump.Flush(); | 3563 ObjDump.Flush(); |
| 3578 return ErrorsFound || Parser.GetNumErrors() > 0; | 3564 return ErrorsFound || Parser.GetNumErrors() > 0; |
| 3579 } | 3565 } |
| 3580 | 3566 |
| 3581 } | 3567 } |
| OLD | NEW |