summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reapply r250906 with many suggested updates from Rafael Espindola.Kevin Enderby2015-11-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is expected. This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. These changes will require corresponding changes to the lld project. That will be committed immediately after this change. But this revision will cause lld failures with this alone which is expected. llvm-svn: 252192
* Backing out commit r250906 as it broke lld.Kevin Enderby2015-10-211-6/+1
| | | | llvm-svn: 250908
* This removes the eating of the error in Archive::Child::getSize() when the ↵Kevin Enderby2015-10-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. Also corrected the code where the size gets us to the “at the end of the archive” which is OK but past the end of the archive will return object_error::parse_failed now. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. llvm-svn: 250906
* Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type ↵Craig Topper2015-09-211-3/+3
| | | | | | extra times. NFC llvm-svn: 248140
* [llvm-cxxdump] Remove duplicate code check.Davide Italiano2015-09-151-6/+0
| | | | | | | We already fail with 'No such file or directory' when we try to open the file -- if that doesn't exist. Also add a test to verify this behavior. llvm-svn: 247744
* [llvm-cxxdump] Correctly process relocations when given multiple filesDavid Majnemer2015-08-131-16/+10
| | | | | | | Archive files wouldn't lead to us reprocessing the section relocations for the new object files. llvm-svn: 244932
* Convert getSymbolSection to return an ErrorOr.Rafael Espindola2015-08-071-2/+3
| | | | | | | This function can actually fail since the symbol contains an index to the section and that can be invalid. llvm-svn: 244375
* [llvm-cxxdump] Don't rely on global stateDavide Italiano2015-07-171-41/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D11227 llvm-svn: 242509
* Return ErrorOr from getSymbolAddress.Rafael Espindola2015-07-031-2/+3
| | | | | | | It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. llvm-svn: 241366
* Return ErrorOr from SymbolRef::getName.Rafael Espindola2015-07-021-8/+9
| | | | | | | | | | | | This function can really fail since the string table offset can be out of bounds. Using ErrorOr makes sure the error is checked. Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object. llvm-svn: 241297
* Don't return error_code from function that never fails.Rafael Espindola2015-06-291-6/+2
| | | | llvm-svn: 241021
* Make computeSymbolSizes never fail.Rafael Espindola2015-06-241-4/+2
| | | | | | | | | | | On ELF that was already the case since getting the size of a symbol never fails. On MachO and COFF we could fail trying to get the section of a symbol. But we don't really need the section, just the section number to know if two symbols are in the same section or not. llvm-svn: 240580
* Compute correct symbol sizes for MachO and COFF.Rafael Espindola2015-06-231-2/+9
| | | | | | Before this would dump from the symbol start to the end of the section. llvm-svn: 240367
* Simplify another function that doesn't fail.Rafael Espindola2015-06-011-2/+3
| | | | llvm-svn: 238703
* Change range-based for-loop to use const auto&. No functionality change.Richard Trieu2015-04-151-16/+11
| | | | llvm-svn: 234974
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-13/+16
| | | | | | No functionality change. llvm-svn: 234963
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-0/+1
| | | | | | NFC. llvm-svn: 232976
* llvm-cxxdump: Rename llvm-vtabledump to llvm-cxxdumpDavid Majnemer2015-03-151-0/+570
llvm-vtabledump has grown enough functionality not related to vtables that it deserves a name which is more descriptive. llvm-svn: 232301
OpenPOWER on IntegriCloud