[llvm] r230821 - [dsymutil] Add -o option to select ouptut filename

Frederic Riss friss at apple.com
Fri Feb 27 16:29:03 PST 2015


Author: friss
Date: Fri Feb 27 18:29:03 2015
New Revision: 230821

URL: http://llvm.org/viewvc/llvm-project?rev=230821&view=rev
Log:
[dsymutil] Add -o option to select ouptut filename

We do not create the output file yet, so no means to test.

Modified:
    llvm/trunk/tools/dsymutil/dsymutil.cpp

Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=230821&r1=230820&r2=230821&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Fri Feb 27 18:29:03 2015
@@ -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."),
@@ -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);
 }





More information about the llvm-commits mailing list