]> granicus.if.org Git - clang/commitdiff
Better handing of stdin/stdout for -emit-llvm-bc
authorChristopher Lamb <christopher.lamb@gmail.com>
Mon, 24 Dec 2007 20:56:07 +0000 (20:56 +0000)
committerChristopher Lamb <christopher.lamb@gmail.com>
Mon, 24 Dec 2007 20:56:07 +0000 (20:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45345 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/ASTConsumers.cpp

index b6bd516385f3dcb9b9117d1dd67f13e84858a6be..df9d2e4fe719be224c480ac10634de2f963b28e6 100644 (file)
@@ -644,14 +644,14 @@ ASTConsumer *clang::CreateBCWriter(const std::string& InFile,
   std::string FileName = OutputFile;
   
   std::ostream *Out;
-  if (!OutputFile.size()) {
+  if (OutputFile == "-" || InFile == "-")
+    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());
-  } else if (OutputFile == "-") {
-    Out = llvm::cout.stream();
   } else {
     Out = new std::ofstream(FileName.c_str());
   }