[cfe-commits] r59597 - in /cfe/trunk: Driver/clang.cpp include/clang/Driver/TextDiagnosticPrinter.h lib/Driver/TextDiagnosticPrinter.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 18 22:56:25 PST 2008
Author: lattner
Date: Wed Nov 19 00:56:25 2008
New Revision: 59597
URL: http://llvm.org/viewvc/llvm-project?rev=59597&view=rev
Log:
switch TextDiagnosticPrinter to raw_ostream.
Modified:
cfe/trunk/Driver/clang.cpp
cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h
cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=59597&r1=59596&r2=59597&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Wed Nov 19 00:56:25 2008
@@ -1443,7 +1443,8 @@
if (!VerifyDiagnostics) {
// Print diagnostics to stderr by default.
- TextDiagClient = new TextDiagnosticPrinter(!NoShowColumn,
+ TextDiagClient = new TextDiagnosticPrinter(llvm::errs(),
+ !NoShowColumn,
!NoCaretDiagnostics);
} else {
// When checking diagnostics, just buffer them up.
Modified: cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h?rev=59597&r1=59596&r2=59597&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h Wed Nov 19 00:56:25 2008
@@ -17,7 +17,10 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
-#include "llvm/Support/Streams.h"
+
+namespace llvm {
+ class raw_ostream;
+}
namespace clang {
class SourceManager;
@@ -25,12 +28,12 @@
class TextDiagnosticPrinter : public DiagnosticClient {
FullSourceLoc LastWarningLoc;
FullSourceLoc LastLoc;
- llvm::OStream OS;
+ llvm::raw_ostream &OS;
bool ShowColumn;
bool CaretDiagnostics;
public:
- TextDiagnosticPrinter(bool showColumn = true, bool caretDiagnistics = true,
- llvm::OStream &os = llvm::cerr)
+ TextDiagnosticPrinter(llvm::raw_ostream &os, bool showColumn = true,
+ bool caretDiagnistics = true)
: OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics) {}
void PrintIncludeStack(FullSourceLoc Pos);
Modified: cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp?rev=59597&r1=59596&r2=59597&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Wed Nov 19 00:56:25 2008
@@ -14,6 +14,7 @@
#include "clang/Driver/TextDiagnosticPrinter.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/SmallString.h"
using namespace clang;
@@ -29,7 +30,7 @@
unsigned LineNo = Pos.getLineNumber();
OS << "In file included from " << Pos.getSourceName()
- << ":" << LineNo << ":\n";
+ << ':' << LineNo << ":\n";
}
/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
@@ -127,10 +128,10 @@
*LineEnd != '\n' && *LineEnd != '\r')
++LineEnd;
- OS << Buffer->getBufferIdentifier() << ":" << LineNo << ":";
+ OS << Buffer->getBufferIdentifier() << ':' << LineNo << ':';
if (ColNo && ShowColumn)
- OS << ColNo << ":";
- OS << " ";
+ OS << ColNo << ':';
+ OS << ' ';
}
switch (Level) {
@@ -193,7 +194,9 @@
CaretLine.erase(CaretLine.end()-1);
// Emit what we have computed.
- OS << SourceLine << "\n";
- OS << CaretLine << "\n";
+ OS << SourceLine << '\n';
+ OS << CaretLine << '\n';
}
+
+ OS.flush();
}
More information about the cfe-commits
mailing list