summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-12-24 03:23:55 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-12-24 03:23:55 +0000
commit5a3416409fe85ca6efd634d2f283445688654fa0 (patch)
tree0710c8756d42c5243f406f489eb8015807940dff
parent76270e6be6b24e5732c0087f2c6f7a5b0177ad44 (diff)
downloadbcm5719-llvm-5a3416409fe85ca6efd634d2f283445688654fa0.tar.gz
bcm5719-llvm-5a3416409fe85ca6efd634d2f283445688654fa0.zip
Allow bitcode output to be redirected to stdout.
llvm-svn: 45340
-rw-r--r--clang/Driver/ASTConsumers.cpp8
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);
}
OpenPOWER on IntegriCloud