aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-17 03:54:39 +0000
committerChris Lattner <sabre@nondot.org>2008-08-17 03:54:39 +0000
commit202e9ac1b17de41914a92ae064f2e6dc445a0b0f (patch)
tree3875d1cce07c6112188921e8fb91c4bf7a731ec0
parentb9d17f9384651d1052a17978d2e160448bfad404 (diff)
simplify this code a bit more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/PrintPreprocessedOutput.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp
index 5044250fd5..28309860ca 100644
--- a/Driver/PrintPreprocessedOutput.cpp
+++ b/Driver/PrintPreprocessedOutput.cpp
@@ -499,23 +499,15 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP,
// 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];