diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2019-01-15 21:52:31 +0000 | 
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2019-01-15 21:52:31 +0000 | 
| commit | 904ce9847d2bf5b73a17a1c067a06f055635fe8b (patch) | |
| tree | 3b0343a4cce7a156c933f6956f7384341f8a3a28 /llvm/tools/llvm-ar/llvm-ar.cpp | |
| parent | efe83db79975e03e3f0cfcc73cf66383ac36eaab (diff) | |
| download | bcm5719-llvm-904ce9847d2bf5b73a17a1c067a06f055635fe8b.tar.gz bcm5719-llvm-904ce9847d2bf5b73a17a1c067a06f055635fe8b.zip | |
[llvm-ar] Resubmit recursive thin archive test with fix for full path names and better error messages
llvm-svn: 351256
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
| -rw-r--r-- | llvm/tools/llvm-ar/llvm-ar.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp index 15a1edebb13..1c453ee0b56 100644 --- a/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/llvm/tools/llvm-ar/llvm-ar.cpp @@ -33,6 +33,7 @@  #include "llvm/Support/StringSaver.h"  #include "llvm/Support/TargetSelect.h"  #include "llvm/Support/ToolOutputFile.h" +#include "llvm/Support/WithColor.h"  #include "llvm/Support/raw_ostream.h"  #include "llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h"  #include "llvm/ToolDrivers/llvm-lib/LibDriver.h" @@ -115,7 +116,7 @@ void printHelpMessage() {  // Show the error message and exit.  LLVM_ATTRIBUTE_NORETURN static void fail(Twine Error) { -  errs() << ToolName << ": " << Error << ".\n"; +  WithColor::error(errs(), ToolName) << Error << ".\n";    printHelpMessage();    exit(1);  } @@ -221,7 +222,7 @@ std::vector<std::unique_ptr<object::Archive>> Archives;  static object::Archive &readLibrary(const Twine &Library) {    auto BufOrErr = MemoryBuffer::getFile(Library, -1, false); -  failIfError(BufOrErr.getError(), "Could not open library"); +  failIfError(BufOrErr.getError(), "Could not open library " + Library);    ArchiveBuffers.push_back(std::move(*BufOrErr));    auto LibOrErr =        object::Archive::create(ArchiveBuffers.back()->getMemBufferRef()); @@ -532,7 +533,7 @@ static void performReadOperation(ArchiveOperation Operation,    if (Members.empty())      return;    for (StringRef Name : Members) -    errs() << Name << " was not found\n"; +    WithColor::error(errs(), ToolName) << "'" << Name << "' was not found\n";    exit(1);  } @@ -546,7 +547,7 @@ static void addChildMember(std::vector<NewArchiveMember> &Members,    failIfError(NMOrErr.takeError());    if (FlattenArchive &&        identify_magic(NMOrErr->Buf->getBuffer()) == file_magic::archive) { -    Expected<StringRef> FileNameOrErr = M.getName(); +    Expected<std::string> FileNameOrErr = M.getFullName();      failIfError(FileNameOrErr.takeError());      object::Archive &Lib = readLibrary(*FileNameOrErr);      // When creating thin archives, only flatten if the member is also thin. @@ -853,7 +854,8 @@ static int performOperation(ArchiveOperation Operation,    } else {      if (!Create) {        // Produce a warning if we should and we're creating the archive -      errs() << ToolName << ": creating " << ArchiveName << "\n"; +      WithColor::warning(errs(), ToolName) +          << "creating " << ArchiveName << "\n";      }    } | 

