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

Daniel Dunbar daniel at zuster.org
Sun Aug 1 19:38:08 PDT 2010


Author: ddunbar
Date: Sun Aug  1 21:38:08 2010
New Revision: 110009

URL: http://llvm.org/viewvc/llvm-project?rev=110009&view=rev
Log:
Driver: Simplify logic for sending 'clang -E t.c' output to 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=110009&r1=110008&r2=110009&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Aug  1 21:38:08 2010
@@ -1078,19 +1078,6 @@
     InputInfos.push_back(II);
   }
 
-  // Determine if we should output to a pipe.
-  bool OutputToPipe = false;
-  if (CanAcceptPipe && T.canPipeOutput()) {
-    // Some actions default to writing to a pipe if they are the top level phase
-    // and there was no user override.
-    //
-    // FIXME: Is there a better way to handle this?
-    if (AtTopLevel) {
-      if (isa<PreprocessJobAction>(A) && !C.getArgs().hasArg(options::OPT_o))
-        OutputToPipe = true;
-    }
-  }
-
   // Figure out where to put the job (pipes).
   Job *Dest = &C.getJobs();
   assert(!InputInfos[0].isPipe() && "Unrequested pipe!");
@@ -1107,18 +1094,6 @@
   // where to put the new job.
   if (JA->getType() == types::TY_Nothing) {
     Result = InputInfo(A->getType(), BaseInput);
-  } else if (OutputToPipe) {
-    // Append to current piped job or create a new one as appropriate.
-    PipedJob *PJ = dyn_cast<PipedJob>(Dest);
-    if (!PJ) {
-      PJ = new PipedJob();
-      // FIXME: Temporary hack so that -ccc-print-bindings work until we have
-      // pipe support. Please remove later.
-      if (!CCCPrintBindings)
-        cast<JobList>(Dest)->addJob(PJ);
-      Dest = PJ;
-    }
-    Result = InputInfo(PJ, A->getType(), BaseInput);
   } else {
     Result = InputInfo(GetNamedOutputPath(C, *JA, BaseInput, AtTopLevel),
                        A->getType(), BaseInput);
@@ -1150,6 +1125,10 @@
       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