Skip to content

Commit

Permalink
[dsymutil] Add -o option to select ouptut filename
Browse files Browse the repository at this point in the history
We do not create the output file yet, so no means to test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230821 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
fredriss committed Feb 28, 2015
1 parent a2cd6a5 commit 77f4ca1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tools/dsymutil/dsymutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ using namespace llvm::cl;
static opt<std::string> InputFile(Positional, desc("<input file>"),
init("a.out"));

static opt<std::string> OutputFileOpt("o", desc("Specify the output file."
" default: <input file>.dwarf"),
value_desc("filename"));

static opt<std::string> OsoPrependPath("oso-prepend-path",
desc("Specify a directory to prepend "
"to the paths of object files."),
Expand Down Expand Up @@ -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);
}

0 comments on commit 77f4ca1

Please sign in to comment.