forked from OSchip/llvm-project
" 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:
parent
ddb2485eb6
commit
1958677ccf
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue