[cfe-commits] r45340 - /cfe/trunk/Driver/ASTConsumers.cpp
Christopher Lamb
christopher.lamb at gmail.com
Sun Dec 23 19:23:55 PST 2007
Author: clamb
Date: Sun Dec 23 21:23:55 2007
New Revision: 45340
URL: http://llvm.org/viewvc/llvm-project?rev=45340&view=rev
Log:
Allow bitcode output to be redirected to stdout.
Modified:
cfe/trunk/Driver/ASTConsumers.cpp
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=45340&r1=45339&r2=45340&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Sun Dec 23 21:23:55 2007
@@ -642,14 +642,20 @@
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);
}
More information about the cfe-commits
mailing list