[dsymutil] Split some logic into a helper function. NFC

llvm-svn: 244085
This commit is contained in:
Frederic Riss 2015-08-05 18:27:34 +00:00
parent 7f4227d59a
commit b22dd10016
1 changed files with 10 additions and 10 deletions

View File

@ -68,6 +68,15 @@ static opt<bool> 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;
}