aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-06 04:43:47 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-06 04:43:47 +0000
commit2cc2b9ca22d21cd855f06f545b8720f6a7a965b4 (patch)
tree369c757f90a0e9913136a84eb258e453608af5b4 /lib/Frontend/TextDiagnosticPrinter.cpp
parent5aeb9e7a211a7873773c3a30edfd9a4db8f889c9 (diff)
Eliminate extra vertical space in Clang diagnostics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 90963c82ac..f936807b6c 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -243,7 +243,6 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
SourceManager &SM,
const CodeModificationHint *Hints,
unsigned NumHints,
- unsigned AvoidColumn,
unsigned Columns) {
assert(!Loc.isInvalid() && "must have a valid source location here");
@@ -253,8 +252,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
if (!Loc.isFileID()) {
SourceLocation OneLevelUp = SM.getImmediateInstantiationRange(Loc).first;
// FIXME: Map ranges?
- EmitCaretDiagnostic(OneLevelUp, Ranges, NumRanges, SM, 0, 0, AvoidColumn,
- Columns);
+ EmitCaretDiagnostic(OneLevelUp, Ranges, NumRanges, SM, 0, 0, Columns);
Loc = SM.getImmediateSpellingLoc(Loc);
@@ -278,7 +276,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
}
OS << "note: instantiated from:\n";
- EmitCaretDiagnostic(Loc, Ranges, NumRanges, SM, Hints, NumHints, 0,Columns);
+ EmitCaretDiagnostic(Loc, Ranges, NumRanges, SM, Hints, NumHints, Columns);
return;
}
@@ -390,20 +388,6 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
SelectInterestingSourceRegion(SourceLine, CaretLine, FixItInsertionLine,
CaretEndColNo, Columns);
- // AvoidColumn tells us which column we should avoid when printing
- // the source line. If the source line would start at or near that
- // column, add another line of whitespace before printing the source
- // line. Otherwise, the source line and the diagnostic text can get
- // jumbled together.
- unsigned StartCol = 0;
- for (unsigned N = SourceLine.size(); StartCol != N; ++StartCol)
- if (!isspace(SourceLine[StartCol]))
- break;
-
- if (StartCol != SourceLine.size() &&
- abs((int)StartCol - (int)AvoidColumn) <= 2)
- OS << '\n';
-
// Finally, remove any blank spaces from the end of CaretLine.
while (CaretLine[CaretLine.size()-1] == ' ')
CaretLine.erase(CaretLine.end()-1);
@@ -673,13 +657,12 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
OutStr += ']';
}
- bool WordWrapped = false;
if (MessageLength) {
// We will be word-wrapping the error message, so compute the
// column number where we currently are (after printing the
// location information).
unsigned Column = OS.tell() - StartOfLocationInfo;
- WordWrapped = PrintWordWrapped(OS, OutStr, MessageLength, Column);
+ PrintWordWrapped(OS, OutStr, MessageLength, Column);
} else {
OS.write(OutStr.begin(), OutStr.size());
}
@@ -718,7 +701,6 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
EmitCaretDiagnostic(LastLoc, Ranges, NumRanges, LastLoc.getManager(),
Info.getCodeModificationHints(),
Info.getNumCodeModificationHints(),
- WordWrapped? WordWrapIndentation : 0,
MessageLength);
}