[cfe-commits] r114712 - /cfe/trunk/lib/Driver/Driver.cpp

Nick Lewycky nicholas at mxc.ca
Thu Sep 23 16:49:25 PDT 2010


Author: nicholas
Date: Thu Sep 23 18:49:25 2010
New Revision: 114712

URL: http://llvm.org/viewvc/llvm-project?rev=114712&view=rev
Log:
Make -M/-MM behave like in gcc; use -MF first then -o else use stdout.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=114712&r1=114711&r2=114712&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Sep 23 18:49:25 2010
@@ -1151,16 +1151,22 @@
                                        const char *BaseInput,
                                        bool AtTopLevel) const {
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
+
+  // Default to writing to stdout.
+  if (AtTopLevel && isa<PreprocessJobAction>(JA)) {
+    if (Arg *DepOutput = C.getArgs().getLastArg(options::OPT_MF))
+      return C.addResultFile(DepOutput->getValue(C.getArgs()));
+    if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+      return C.addResultFile(FinalOutput->getValue(C.getArgs()));
+    return "-";
+  }
+
   // Output to a user requested destination?
   if (AtTopLevel && !isa<DsymutilJobAction>(JA)) {
     if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
       return C.addResultFile(FinalOutput->getValue(C.getArgs()));
   }
 
-  // Default to writing to stdout?
-  if (AtTopLevel && isa<PreprocessJobAction>(JA))
-    return "-";
-
   // Output to a temporary file?
   if (!AtTopLevel && !C.getArgs().hasArg(options::OPT_save_temps)) {
     std::string TmpName =





More information about the cfe-commits mailing list