Almost the best possible handling of stdin/stdout for llvm-emit-bc!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45346 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index df9d2e4..f3b595f 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -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());
   }