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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 // Be sure to flush any remaining errors. | 584 // Be sure to flush any remaining errors. |
585 ObjDump.Flush(); | 585 ObjDump.Flush(); |
586 } | 586 } |
587 | 587 |
588 // Returns the number of errors that were sent to the ObjDump. | 588 // Returns the number of errors that were sent to the ObjDump. |
589 unsigned GetNumErrors() { | 589 unsigned GetNumErrors() { |
590 return ObjDump.GetNumErrors(); | 590 return ObjDump.GetNumErrors(); |
591 } | 591 } |
592 | 592 |
593 /// Generates an error with the given message. | 593 /// Generates an error with the given message. |
594 bool Error(const std::string &Message) override { | 594 bool ErrorAt(uint64_t Bit, const std::string &Message) final { |
595 // Use local error routine so that all errors are treated uniformly. | 595 // Use local error routine so that all errors are treated uniformly. |
596 ObjDump.Error() << Message << "\n"; | 596 ObjDump.Error(Bit) << Message << "\n"; |
597 return true; | 597 return true; |
598 } | 598 } |
599 | 599 |
600 /// Flushes out objdump and then exits with fatal error. | 600 /// Flushes out objdump and then exits with fatal error. |
| 601 LLVM_ATTRIBUTE_NORETURN |
601 void Fatal() { | 602 void Fatal() { |
602 Fatal(""); | 603 NaClBitcodeParser::Fatal(); |
603 } | 604 } |
604 | 605 |
605 /// Flushes out objdump and then exits with fatal error, using | 606 /// Flushes out objdump and then exits with fatal error, using |
606 /// the given message. | 607 /// the given message. |
607 void Fatal(const std::string &Message) { | 608 LLVM_ATTRIBUTE_NORETURN |
608 ObjDump.Fatal(Message); | 609 void FatalAt(uint64_t Bit, const std::string &Message) final { |
| 610 ObjDump.Fatal(Bit, Message); |
609 } | 611 } |
610 | 612 |
611 /// Parses the top-level module block. | 613 /// Parses the top-level module block. |
612 bool ParseBlock(unsigned BlockID) override; | 614 bool ParseBlock(unsigned BlockID) override; |
613 | 615 |
614 /// Installs the given type to the next available type index. | 616 /// Installs the given type to the next available type index. |
615 void InstallType(Type *Ty) { | 617 void InstallType(Type *Ty) { |
616 TypeIdType.push_back(Ty); | 618 TypeIdType.push_back(Ty); |
617 } | 619 } |
618 | 620 |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 } | 1366 } |
1365 | 1367 |
1366 raw_ostream &Warnings() { | 1368 raw_ostream &Warnings() { |
1367 return Context->Warnings(); | 1369 return Context->Warnings(); |
1368 } | 1370 } |
1369 | 1371 |
1370 void Fatal() { | 1372 void Fatal() { |
1371 return Context->Fatal(); | 1373 return Context->Fatal(); |
1372 } | 1374 } |
1373 | 1375 |
1374 void Fatal(const std::string &Message) { | 1376 void FatalAt(uint64_t Bit, const std::string &Message) override { |
1375 return Context->Fatal(Message); | 1377 return Context->FatalAt(Bit, Message); |
1376 } | 1378 } |
1377 | 1379 |
1378 const std::string &GetAssemblyIndent() const { | 1380 const std::string &GetAssemblyIndent() const { |
1379 return Context->GetAssemblyIndent(); | 1381 return Context->GetAssemblyIndent(); |
1380 } | 1382 } |
1381 | 1383 |
1382 unsigned GetAssemblyNumTabs() const { | 1384 unsigned GetAssemblyNumTabs() const { |
1383 return Context->GetAssemblyNumTabs(); | 1385 return Context->GetAssemblyNumTabs(); |
1384 } | 1386 } |
1385 | 1387 |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3569 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" | 3571 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" |
3570 << NumBlocksRead << "\n"; | 3572 << NumBlocksRead << "\n"; |
3571 ErrorsFound = true; | 3573 ErrorsFound = true; |
3572 } | 3574 } |
3573 | 3575 |
3574 ObjDump.Flush(); | 3576 ObjDump.Flush(); |
3575 return ErrorsFound || Parser.GetNumErrors() > 0; | 3577 return ErrorsFound || Parser.GetNumErrors() > 0; |
3576 } | 3578 } |
3577 | 3579 |
3578 } | 3580 } |
OLD | NEW |