" Attached is a patch for TextDiagnosticPrinter that adds an optional

parameter that allows users to omit the printing of the source
location on a diagnostic. So basically it would omit the "abc.c:5:1: "
at the beginning of the line."

Patch by Alexei Svitkine!

llvm-svn: 63396
This commit is contained in:
Chris Lattner 2009-01-30 17:41:53 +00:00
parent ddb2485eb6
commit 1958677ccf
2 changed files with 10 additions and 6 deletions

View File

@ -31,10 +31,12 @@ class TextDiagnosticPrinter : public DiagnosticClient {
llvm::raw_ostream &OS;
bool ShowColumn;
bool CaretDiagnostics;
bool ShowLocation;
public:
TextDiagnosticPrinter(llvm::raw_ostream &os, bool showColumn = true,
bool caretDiagnistics = true)
: OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics) {}
bool caretDiagnistics = true, bool showLocation = true)
: OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics),
ShowLocation(showLocation) {}
void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM);

View File

@ -113,10 +113,12 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
// Compute the column number.
ColNo = PLoc.getColumn();
OS << PLoc.getFilename() << ':' << LineNo << ':';
if (ColNo && ShowColumn)
OS << ColNo << ':';
OS << ' ';
if (ShowLocation) {
OS << PLoc.getFilename() << ':' << LineNo << ':';
if (ColNo && ShowColumn)
OS << ColNo << ':';
OS << ' ';
}
}
switch (Level) {