From: Christopher Lamb Date: Mon, 24 Dec 2007 20:56:07 +0000 (+0000) Subject: Better handing of stdin/stdout for -emit-llvm-bc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bd848f1e851bb46772a517e76dccc92465a57ae;p=clang Better handing of stdin/stdout for -emit-llvm-bc git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45345 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index b6bd516385..df9d2e4fe7 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -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()); }