From: Frederic Riss Date: Wed, 5 Aug 2015 18:27:34 +0000 (+0000) Subject: [dsymutil] Split some logic into a helper function. NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cca89d34ba62b82483513be3876ab1bd30885ae6;p=oota-llvm.git [dsymutil] Split some logic into a helper function. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244085 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/dsymutil/dsymutil.cpp b/tools/dsymutil/dsymutil.cpp index a473c405ea8..54a4b5b3332 100644 --- a/tools/dsymutil/dsymutil.cpp +++ b/tools/dsymutil/dsymutil.cpp @@ -68,6 +68,15 @@ static opt InputIsYAMLDebugMap( init(false), cat(DsymCategory)); } +static std::string getOutputFileName(llvm::StringRef InputFile) { + if (OutputFileOpt.empty()) { + if (InputFile == "-") + return "a.out.dwarf"; + return (InputFile + ".dwarf").str(); + } + return OutputFileOpt; +} + int main(int argc, char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); llvm::PrettyStackTraceProgram StackPrinter(argc, argv); @@ -120,16 +129,7 @@ int main(int argc, char **argv) { if (DumpDebugMap) continue; - std::string OutputFile; - if (OutputFileOpt.empty()) { - if (InputFile == "-") - OutputFile = "a.out.dwarf"; - else - OutputFile = InputFile + ".dwarf"; - } else { - OutputFile = OutputFileOpt; - } - + std::string OutputFile = getOutputFileName(InputFile); if (!linkDwarf(OutputFile, **DebugMapPtrOrErr, Options)) return 1; }