[cfe-commits] r79809 - in /cfe/trunk: lib/AST/InheritViz.cpp lib/Frontend/AnalysisConsumer.cpp lib/Frontend/FixItRewriter.cpp lib/Frontend/PlistDiagnostics.cpp tools/clang-cc/clang-cc.cpp
Chris Lattner
sabre at nondot.org
Sat Aug 22 19:59:42 PDT 2009
Author: lattner
Date: Sat Aug 22 21:59:41 2009
New Revision: 79809
URL: http://llvm.org/viewvc/llvm-project?rev=79809&view=rev
Log:
adjust for raw_fd_ostream api change.
Modified:
cfe/trunk/lib/AST/InheritViz.cpp
cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
cfe/trunk/lib/Frontend/FixItRewriter.cpp
cfe/trunk/lib/Frontend/PlistDiagnostics.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/lib/AST/InheritViz.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/InheritViz.cpp?rev=79809&r1=79808&r2=79809&view=diff
==============================================================================
--- cfe/trunk/lib/AST/InheritViz.cpp (original)
+++ cfe/trunk/lib/AST/InheritViz.cpp Sat Aug 22 21:59:41 2009
@@ -149,7 +149,8 @@
llvm::errs() << "Writing '" << Filename.c_str() << "'... ";
- llvm::raw_fd_ostream O(Filename.c_str(), false, /*Force=*/true, ErrMsg);
+ llvm::raw_fd_ostream O(Filename.c_str(), ErrMsg,
+ raw_fd_ostream::F_Force);
if (ErrMsg.empty()) {
InheritanceHierarchyWriter Writer(Context, O);
Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=79809&r1=79808&r2=79809&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Sat Aug 22 21:59:41 2009
@@ -480,8 +480,8 @@
llvm::OwningPtr<llvm::raw_fd_ostream> Stream;
std::string filename = Filename.toString();
- Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), false,
- /*Force=*/true, ErrMsg));
+ Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), ErrMsg,
+ llvm::raw_fd_ostream::F_Force));
if (!ErrMsg.empty())
return 0;
Modified: cfe/trunk/lib/Frontend/FixItRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FixItRewriter.cpp?rev=79809&r1=79808&r2=79809&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FixItRewriter.cpp (original)
+++ cfe/trunk/lib/Frontend/FixItRewriter.cpp Sat Aug 22 21:59:41 2009
@@ -44,11 +44,9 @@
llvm::raw_ostream *OutFile;
if (!OutFileName.empty()) {
std::string Err;
- OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(),
- // set binary mode (critical for Windoze)
- true,
- /*Force=*/true,
- Err);
+ OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), Err,
+ llvm::raw_fd_ostream::F_Binary |
+ llvm::raw_fd_ostream::F_Force);
OwnedStream.reset(OutFile);
} else if (InFileName == "-") {
OutFile = &llvm::outs();
@@ -58,11 +56,9 @@
Path.eraseSuffix();
Path.appendSuffix("fixit." + Suffix);
std::string Err;
- OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(),
- // set binary mode (critical for Windoze)
- true,
- /*Force=*/true,
- Err);
+ OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), Err,
+ llvm::raw_fd_ostream::F_Binary |
+ llvm::raw_fd_ostream::F_Force);
OwnedStream.reset(OutFile);
}
Modified: cfe/trunk/lib/Frontend/PlistDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PlistDiagnostics.cpp?rev=79809&r1=79808&r2=79809&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/Frontend/PlistDiagnostics.cpp Sat Aug 22 21:59:41 2009
@@ -337,7 +337,8 @@
// Open the file.
std::string ErrMsg;
- llvm::raw_fd_ostream o(OutputFile.c_str(), false, /*Force=*/true, ErrMsg);
+ llvm::raw_fd_ostream o(OutputFile.c_str(), ErrMsg,
+ llvm::raw_fd_ostream::F_Force);
if (!ErrMsg.empty()) {
llvm::errs() << "warning: could not creat file: " << OutputFile << '\n';
return;
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=79809&r1=79808&r2=79809&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Sat Aug 22 21:59:41 2009
@@ -63,7 +63,6 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Streams.h"
#include "llvm/Support/Timer.h"
#include "llvm/System/Host.h"
#include "llvm/System/Path.h"
@@ -1701,8 +1700,9 @@
llvm::OwningPtr<DiagnosticClient> &DiagClient) {
std::string ErrorInfo;
- BuildLogFile = new llvm::raw_fd_ostream(DumpBuildInformation.c_str(), false,
- /*Force=*/true, ErrorInfo);
+ BuildLogFile = new llvm::raw_fd_ostream(DumpBuildInformation.c_str(),
+ ErrorInfo,
+ llvm::raw_fd_ostream::F_Force);
if (!ErrorInfo.empty()) {
llvm::errs() << "error opening -dump-build-information file '"
@@ -1729,41 +1729,37 @@
// Main driver
//===----------------------------------------------------------------------===//
-static llvm::raw_ostream* ComputeOutFile(const std::string& InFile,
- const char* Extension,
+static llvm::raw_ostream *ComputeOutFile(const std::string &InFile,
+ const char *Extension,
bool Binary,
llvm::sys::Path& OutPath) {
- llvm::raw_ostream* Ret;
- bool UseStdout = false;
+ llvm::raw_ostream *Ret;
std::string OutFile;
- if (OutputFile == "-" || (OutputFile.empty() && InFile == "-")) {
- UseStdout = true;
- } else if (!OutputFile.empty()) {
+ if (!OutputFile.empty())
OutFile = OutputFile;
+ else if (InFile == "-") {
+ OutFile = "-";
} else if (Extension) {
llvm::sys::Path Path(InFile);
Path.eraseSuffix();
Path.appendSuffix(Extension);
OutFile = Path.toString();
} else {
- UseStdout = true;
+ OutFile = "-";
}
- if (UseStdout) {
- Ret = new llvm::raw_stdout_ostream();
- if (Binary)
- llvm::sys::Program::ChangeStdoutToBinary();
- } else {
- std::string Error;
- Ret = new llvm::raw_fd_ostream(OutFile.c_str(), Binary,
- /*Force=*/true, Error);
- if (!Error.empty()) {
- // FIXME: Don't fail this way.
- llvm::cerr << "ERROR: " << Error << "\n";
- ::exit(1);
- }
- OutPath = OutFile;
+ std::string Error;
+ Ret = new llvm::raw_fd_ostream(OutFile.c_str(), Error,
+ (Binary ? llvm::raw_fd_ostream::F_Binary : 0) |
+ llvm::raw_fd_ostream::F_Force);
+ if (!Error.empty()) {
+ // FIXME: Don't fail this way.
+ llvm::errs() << "ERROR: " << Error << "\n";
+ ::exit(1);
}
+
+ if (OutFile != "-")
+ OutPath = OutFile;
return Ret;
}
@@ -1915,7 +1911,7 @@
if (OutputFile.empty() || OutputFile == "-") {
// FIXME: Don't fail this way.
// FIXME: Verify that we can actually seek in the given file.
- llvm::cerr << "ERROR: PTH requires an seekable file for output!\n";
+ llvm::errs() << "ERROR: PTH requires an seekable file for output!\n";
::exit(1);
}
OS.reset(ComputeOutFile(InFile, 0, true, OutPath));
@@ -2307,17 +2303,17 @@
llvm::raw_ostream *DependencyOS;
if (DependencyTargets.empty()) {
// FIXME: Use a proper diagnostic
- llvm::cerr << "-dependency-file requires at least one -MT option\n";
+ llvm::errs() << "-dependency-file requires at least one -MT option\n";
HadErrors = true;
continue;
}
std::string ErrStr;
DependencyOS =
- new llvm::raw_fd_ostream(DependencyFile.c_str(), false,
- /*Force=*/true, ErrStr);
+ new llvm::raw_fd_ostream(DependencyFile.c_str(), ErrStr,
+ llvm::raw_fd_ostream::F_Force);
if (!ErrStr.empty()) {
// FIXME: Use a proper diagnostic
- llvm::cerr << "unable to open dependency file: " + ErrStr;
+ llvm::errs() << "unable to open dependency file: " + ErrStr;
HadErrors = true;
continue;
}
More information about the cfe-commits
mailing list