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.
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
-#include "llvm/Support/Streams.h"
+
+namespace llvm {
+ class raw_ostream;
+}
namespace clang {
class SourceManager;
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);
#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;
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)
*LineEnd != '\n' && *LineEnd != '\r')
++LineEnd;
- OS << Buffer->getBufferIdentifier() << ":" << LineNo << ":";
+ OS << Buffer->getBufferIdentifier() << ':' << LineNo << ':';
if (ColNo && ShowColumn)
- OS << ColNo << ":";
- OS << " ";
+ OS << ColNo << ':';
+ OS << ' ';
}
switch (Level) {
CaretLine.erase(CaretLine.end()-1);
// Emit what we have computed.
- OS << SourceLine << "\n";
- OS << CaretLine << "\n";
+ OS << SourceLine << '\n';
+ OS << CaretLine << '\n';
}
+
+ OS.flush();
}