diff options
Diffstat (limited to 'llvm/tools/dsymutil/dsymutil.cpp')
-rw-r--r-- | llvm/tools/dsymutil/dsymutil.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index bbde2094f02..533ff896713 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -15,6 +15,7 @@ #include "dsymutil.h" #include "CFBundle.h" #include "DebugMap.h" +#include "ErrorReporting.h" #include "MachOUtils.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" @@ -156,8 +157,8 @@ static bool createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) { std::error_code EC; llvm::raw_fd_ostream PL(InfoPlist, EC, llvm::sys::fs::F_Text); if (EC) { - llvm::errs() << "error: cannot create plist file " << InfoPlist << ": " - << EC.message() << '\n'; + error_ostream() << "cannot create plist file " << InfoPlist << ": " + << EC.message() << '\n'; return false; } @@ -214,8 +215,8 @@ static bool createBundleDir(llvm::StringRef BundleBase) { llvm::sys::path::append(Bundle, "Contents", "Resources", "DWARF"); if (std::error_code EC = create_directories(Bundle.str(), true, llvm::sys::fs::perms::all_all)) { - llvm::errs() << "error: cannot create directory " << Bundle << ": " - << EC.message() << "\n"; + error_ostream() << "cannot create directory " << Bundle << ": " + << EC.message() << "\n"; return false; } return true; @@ -223,8 +224,8 @@ static bool createBundleDir(llvm::StringRef BundleBase) { static bool verify(llvm::StringRef OutputFile, llvm::StringRef Arch) { if (OutputFile == "-") { - llvm::errs() << "warning: verification skipped for " << Arch - << "because writing to stdout.\n"; + warn_ostream() << "verification skipped for " << Arch + << "because writing to stdout.\n"; return true; } @@ -242,7 +243,7 @@ static bool verify(llvm::StringRef OutputFile, llvm::StringRef Arch) { DIDumpOptions DumpOpts; bool success = DICtx->verify(os, DumpOpts.noImplicitRecursion()); if (!success) - errs() << "error: verification failed for " << Arch << '\n'; + error_ostream() << "verification failed for " << Arch << '\n'; return success; } @@ -314,7 +315,7 @@ static Expected<LinkOptions> getOptions() { // used a unique BinaryHolder object that could cache multiple // binaries this restriction would go away. return make_error<StringError>( - "error: standard input cannot be used as input for a dSYM update.", + "standard input cannot be used as input for a dSYM update.", inconvertibleErrorCode()); } @@ -404,7 +405,7 @@ int main(int argc, char **argv) { auto OptionsOrErr = getOptions(); if (!OptionsOrErr) { - errs() << "error: " << toString(OptionsOrErr.takeError()); + error_ostream() << toString(OptionsOrErr.takeError()); return 1; } @@ -415,24 +416,24 @@ int main(int argc, char **argv) { auto InputsOrErr = getInputs(OptionsOrErr->Update); if (!InputsOrErr) { - errs() << "error: " << toString(InputsOrErr.takeError()) << '\n'; + error_ostream() << toString(InputsOrErr.takeError()) << '\n'; return 1; } if (!FlatOut && OutputFileOpt == "-") { - llvm::errs() << "error: cannot emit to standard output without --flat\n"; + error_ostream() << "cannot emit to standard output without --flat\n"; return 1; } if (InputsOrErr->size() > 1 && FlatOut && !OutputFileOpt.empty()) { - llvm::errs() << "error: cannot use -o with multiple inputs in flat mode\n"; + error_ostream() << "cannot use -o with multiple inputs in flat mode\n"; return 1; } for (const auto &Arch : ArchFlags) if (Arch != "*" && Arch != "all" && !llvm::object::MachOObjectFile::isValidArch(Arch)) { - llvm::errs() << "error: Unsupported cpu architecture: '" << Arch << "'\n"; + error_ostream() << "unsupported cpu architecture: '" << Arch << "'\n"; return 1; } @@ -448,8 +449,8 @@ int main(int argc, char **argv) { Verbose, InputIsYAMLDebugMap); if (auto EC = DebugMapPtrsOrErr.getError()) { - llvm::errs() << "error: cannot parse the debug map for \"" << InputFile - << "\": " << EC.message() << '\n'; + error_ostream() << "cannot parse the debug map for '" << InputFile + << "': " << EC.message() << '\n'; return 1; } @@ -463,7 +464,7 @@ int main(int argc, char **argv) { // Ensure that the debug map is not empty (anymore). if (DebugMapPtrsOrErr->empty()) { - llvm::errs() << "error: no architecture to link\n"; + error_ostream() << "no architecture to link\n"; return 1; } @@ -492,9 +493,10 @@ int main(int argc, char **argv) { continue; if (Map->begin() == Map->end()) - llvm::errs() << "warning: no debug symbols in executable (-arch " - << MachOUtils::getArchName(Map->getTriple().getArchName()) - << ")\n"; + warn_ostream() << "no debug symbols in executable (-arch " + << MachOUtils::getArchName( + Map->getTriple().getArchName()) + << ")\n"; // Using a std::shared_ptr rather than std::unique_ptr because move-only // types don't work with std::bind in the ThreadPool implementation. |