From 51bd34aa38869bb977e076bf66db26fad9c5560f Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Sat, 28 Feb 2015 00:29:03 +0000 Subject: [PATCH] [dsymutil] Add -o option to select ouptut filename We do not create the output file yet, so no means to test. llvm-svn: 230821 --- llvm/tools/dsymutil/dsymutil.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index 2b4fcfe07008..baa07d67093d 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -29,6 +29,10 @@ using namespace llvm::cl; static opt InputFile(Positional, desc(""), init("a.out")); +static opt OutputFileOpt("o", desc("Specify the output file." + " default: .dwarf"), + value_desc("filename")); + static opt OsoPrependPath("oso-prepend-path", desc("Specify a directory to prepend " "to the paths of object files."), @@ -63,9 +67,15 @@ int main(int argc, char **argv) { if (ParseOnly) return 0; - std::string OutputBasename(InputFile); - if (OutputBasename == "-") - OutputBasename = "a.out"; + std::string OutputFile; + if (OutputFileOpt.empty()) { + if (InputFile == "-") + OutputFile = "a.out.dwarf"; + else + OutputFile = InputFile + ".dwarf"; + } else { + OutputFile = OutputFileOpt; + } - return !linkDwarf(OutputBasename + ".dwarf", **DebugMapPtrOrErr, Verbose); + return !linkDwarf(OutputFile, **DebugMapPtrOrErr, Verbose); }