diff options
-rw-r--r-- | clang/Driver/ASTConsumers.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/Driver/ASTConsumers.cpp b/clang/Driver/ASTConsumers.cpp index c3a6b67562e..b6bd516385f 100644 --- a/clang/Driver/ASTConsumers.cpp +++ b/clang/Driver/ASTConsumers.cpp @@ -642,14 +642,20 @@ ASTConsumer *clang::CreateBCWriter(const std::string& InFile, Diagnostic &Diags, const LangOptions &Features) { std::string FileName = OutputFile; + + std::ostream *Out; 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()); } - std::ofstream *Out = new std::ofstream(FileName.c_str()); return new BCWriter(Out, Diags, Features); } |