[cfe-commits] r54864 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Chris Lattner
sabre at nondot.org
Sat Aug 16 20:54:40 PDT 2008
Author: lattner
Date: Sat Aug 16 22:54:39 2008
New Revision: 54864
URL: http://llvm.org/viewvc/llvm-project?rev=54864&view=rev
Log:
simplify this code a bit more.
Modified:
cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=54864&r1=54863&r2=54864&view=diff
==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Sat Aug 16 22:54:39 2008
@@ -499,23 +499,15 @@
// Open the output buffer.
- static llvm::raw_ostream *OutStream;
-
- if (!OutFile.size() || OutFile == "-") {
- OutStream = new llvm::raw_stdout_ostream();
- } else {
- std::string Err;
- OutStream = new llvm::raw_fd_ostream(OutFile.c_str(), Err);
-
- if (!Err.empty()) {
- delete OutStream;
- fprintf(stderr, "%s\n", Err.c_str());
- exit(1);
- }
+ std::string Err;
+ llvm::raw_fd_ostream OS(OutFile.c_str(), Err);
+ if (!Err.empty()) {
+ fprintf(stderr, "%s\n", Err.c_str());
+ exit(1);
}
- OutStream->SetBufferSize(64*1024);
- llvm::raw_ostream &OS = *OutStream;
+ OS.SetBufferSize(64*1024);
+
Token Tok, PrevTok;
char Buffer[256];
More information about the cfe-commits
mailing list