diff options
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp b/contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp index 40f1eec162be..772f124c5a59 100644 --- a/contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-tapi-diff/llvm-tapi-diff.cpp @@ -1,6 +1,4 @@ -//===-- llvm-tapi-diff.cpp - tbd comparator command-line driver ---*- -// C++ -//-*-===// +//===-- llvm-tapi-diff.cpp - tbd comparator command-line driver --*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -31,16 +29,8 @@ cl::opt<std::string> InputFileNameLHS(cl::Positional, cl::desc("<first file>"), cl::cat(NMCat)); cl::opt<std::string> InputFileNameRHS(cl::Positional, cl::desc("<second file>"), cl::cat(NMCat)); - -std::string ToolName; } // anonymous namespace -ExitOnError ExitOnErr; - -void setErrorBanner(ExitOnError &ExitOnErr, std::string InputFile) { - ExitOnErr.setBanner(ToolName + ": error: " + InputFile + ": "); -} - Expected<std::unique_ptr<Binary>> convertFileToBinary(std::string &Filename) { ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = MemoryBuffer::getFileOrSTDIN(Filename); @@ -52,35 +42,29 @@ Expected<std::unique_ptr<Binary>> convertFileToBinary(std::string &Filename) { int main(int Argc, char **Argv) { InitLLVM X(Argc, Argv); cl::HideUnrelatedOptions(NMCat); - cl::ParseCommandLineOptions( - Argc, Argv, - "This tool will compare two tbd files and return the " - "differences in those files."); + cl::ParseCommandLineOptions(Argc, Argv, "Text-based Stubs Comparison Tool"); if (InputFileNameLHS.empty() || InputFileNameRHS.empty()) { cl::PrintHelpMessage(); return EXIT_FAILURE; } - ToolName = Argv[0]; - - setErrorBanner(ExitOnErr, InputFileNameLHS); + ExitOnError ExitOnErr("error: '" + InputFileNameLHS + "' ", + /*DefaultErrorExitCode=*/2); auto BinLHS = ExitOnErr(convertFileToBinary(InputFileNameLHS)); TapiUniversal *FileLHS = dyn_cast<TapiUniversal>(BinLHS.get()); if (!FileLHS) { - ExitOnErr( - createStringError(std::errc::executable_format_error, - "Error when parsing file, unsupported file format")); + ExitOnErr(createStringError(std::errc::executable_format_error, + "unsupported file format")); } - setErrorBanner(ExitOnErr, InputFileNameRHS); + ExitOnErr.setBanner("error: '" + InputFileNameRHS + "' "); auto BinRHS = ExitOnErr(convertFileToBinary(InputFileNameRHS)); TapiUniversal *FileRHS = dyn_cast<TapiUniversal>(BinRHS.get()); if (!FileRHS) { - ExitOnErr( - createStringError(std::errc::executable_format_error, - "Error when parsing file, unsupported file format")); + ExitOnErr(createStringError(std::errc::executable_format_error, + "unsupported file format")); } raw_ostream &OS = outs(); |