[cfe-commits] r45346 - /cfe/trunk/Driver/ASTConsumers.cpp

Christopher Lamb christopher.lamb at gmail.com
Mon Dec 24 12:59:37 PST 2007


Author: clamb
Date: Mon Dec 24 14:59:36 2007
New Revision: 45346

URL: http://llvm.org/viewvc/llvm-project?rev=45346&view=rev
Log:
Almost the best possible handling of stdin/stdout for llvm-emit-bc!

Modified:
    cfe/trunk/Driver/ASTConsumers.cpp

Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=45346&r1=45345&r2=45346&view=diff

==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Mon Dec 24 14:59:36 2007
@@ -644,14 +644,18 @@
   std::string FileName = OutputFile;
   
   std::ostream *Out;
-  if (OutputFile == "-" || InFile == "-")
+  if (OutputFile == "-")
     Out = llvm::cout.stream();
   else if (!OutputFile.size()) {
-    llvm::sys::Path Path(InFile);
-    Path.eraseSuffix();
-    Path.appendSuffix("bc");
-    FileName = Path.toString();
-    Out = new std::ofstream(FileName.c_str());
+    if (InFile == "-")
+      Out = llvm::cout.stream();
+    else {
+      llvm::sys::Path Path(InFile);
+      Path.eraseSuffix();
+      Path.appendSuffix("bc");
+      FileName = Path.toString();
+      Out = new std::ofstream(FileName.c_str());
+    }
   } else {
     Out = new std::ofstream(FileName.c_str());
   }





More information about the cfe-commits mailing list