summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cxxdump
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-05-17 17:10:12 +0000
committerKevin Enderby <enderby@apple.com>2016-05-17 17:10:12 +0000
commitac9e15551dfccb2996708534648e6b7e8d4fee8a (patch)
tree2c0c21fb4b4d25171654d1e0800555a949c4f355 /llvm/tools/llvm-cxxdump
parent75259bb3cb719446b3b705bd85ddb7ad3cb9cce7 (diff)
downloadbcm5719-llvm-ac9e15551dfccb2996708534648e6b7e8d4fee8a.tar.gz
bcm5719-llvm-ac9e15551dfccb2996708534648e6b7e8d4fee8a.zip
Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is in an archive to use something like libx.a(foo.o) as part of the error message. Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object files in archives and not produce any error message. To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting this interface to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in one place yet to be fully converted. Again there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comments for those. llvm-svn: 269784
Diffstat (limited to 'llvm/tools/llvm-cxxdump')
-rw-r--r--llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index 206d65b6c20..d4a290c786b 100644
--- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -485,11 +485,17 @@ static void dumpArchive(const Archive *Arc) {
for (auto &ErrorOrChild : Arc->children()) {
error(ErrorOrChild.getError());
const Archive::Child &ArcC = *ErrorOrChild;
- ErrorOr<std::unique_ptr<Binary>> ChildOrErr = ArcC.getAsBinary();
- if (std::error_code EC = ChildOrErr.getError()) {
+ Expected<std::unique_ptr<Binary>> ChildOrErr = ArcC.getAsBinary();
+ if (!ChildOrErr) {
// Ignore non-object files.
- if (EC != object_error::invalid_file_type)
- reportError(Arc->getFileName(), EC.message());
+ if (auto E = isNotObjectErrorInvalidFileType(ChildOrErr.takeError())) {
+ std::string Buf;
+ raw_string_ostream OS(Buf);
+ logAllUnhandledErrors(std::move(E), OS, "");
+ OS.flush();
+ reportError(Arc->getFileName(), Buf);
+ }
+ ChildOrErr.takeError();
continue;
}
OpenPOWER on IntegriCloud