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

Frederic Riss friss at apple.com
Wed Aug 5 11:27:34 PDT 2015


Author: friss
Date: Wed Aug  5 13:27:34 2015
New Revision: 244085

URL: http://llvm.org/viewvc/llvm-project?rev=244085&view=rev
Log:
[dsymutil] Split some logic into a helper function. NFC

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=244085&r1=244084&r2=244085&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Wed Aug  5 13:27:34 2015
@@ -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;
   }




More information about the llvm-commits mailing list