aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2008-08-09 19:58:22 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2008-08-09 19:58:22 +0000
commitaad6953ca1149d44cebadca8839745796bfd524e (patch)
tree1e9871dbf65c9d89594fb0b3f4f716e84ac5d988 /lib/Driver/TextDiagnosticPrinter.cpp
parentdae86966bbfcf7a6e9fbc7c7ac9dfaa983308d51 (diff)
Expressive diagnostics-- worth their weight in gold?
(Fixing a spelling error.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Driver/TextDiagnosticPrinter.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp
index 5188f4dfa1..f8f6b3599b 100644
--- a/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/lib/Driver/TextDiagnosticPrinter.cpp
@@ -39,10 +39,10 @@ PrintIncludeStack(FullSourceLoc Pos) {
void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
SourceManager& SourceMgr,
unsigned LineNo, unsigned FileID,
- std::string &CaratLine,
+ std::string &CaretLine,
const std::string &SourceLine) {
- assert(CaratLine.size() == SourceLine.size() &&
- "Expect a correspondence between source and carat line!");
+ assert(CaretLine.size() == SourceLine.size() &&
+ "Expect a correspondence between source and caret line!");
if (!R.isValid()) return;
SourceLocation LogicalStart = SourceMgr.getLogicalLoc(R.getBegin());
@@ -68,7 +68,7 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
++StartColNo;
// Compute the column number of the end.
- unsigned EndColNo = CaratLine.size();
+ unsigned EndColNo = CaretLine.size();
if (EndLineNo == LineNo) {
EndColNo = SourceMgr.getLogicalColumnNumber(R.getEnd());
if (EndColNo) {
@@ -77,7 +77,7 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
// Add in the length of the token, so that we cover multi-char tokens.
EndColNo += Lexer::MeasureTokenLength(R.getEnd(), SourceMgr);
} else {
- EndColNo = CaratLine.size();
+ EndColNo = CaretLine.size();
}
}
@@ -92,7 +92,7 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
// Fill the range with ~'s.
assert(StartColNo <= EndColNo && "Invalid range!");
for (unsigned i = StartColNo; i < EndColNo; ++i)
- CaratLine[i] = '~';
+ CaretLine[i] = '~';
}
void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
@@ -158,23 +158,23 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
// Get the line of the source file.
std::string SourceLine(LineStart, LineEnd);
- // Create a line for the carat that is filled with spaces that is the same
+ // Create a line for the caret that is filled with spaces that is the same
// length as the line of source code.
- std::string CaratLine(LineEnd-LineStart, ' ');
+ std::string CaretLine(LineEnd-LineStart, ' ');
// Highlight all of the characters covered by Ranges with ~ characters.
for (unsigned i = 0; i != NumRanges; ++i)
HighlightRange(Ranges[i], Pos.getManager(), LineNo, FileID,
- CaratLine, SourceLine);
+ CaretLine, SourceLine);
- // Next, insert the carat itself.
- if (ColNo-1 < CaratLine.size())
- CaratLine[ColNo-1] = '^';
+ // Next, insert the caret itself.
+ if (ColNo-1 < CaretLine.size())
+ CaretLine[ColNo-1] = '^';
else
- CaratLine.push_back('^');
+ CaretLine.push_back('^');
// Scan the source line, looking for tabs. If we find any, manually expand
- // them to 8 characters and update the CaratLine to match.
+ // them to 8 characters and update the CaretLine to match.
for (unsigned i = 0; i != SourceLine.size(); ++i) {
if (SourceLine[i] != '\t') continue;
@@ -188,16 +188,16 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
// Insert spaces into the SourceLine.
SourceLine.insert(i+1, NumSpaces, ' ');
- // Insert spaces or ~'s into CaratLine.
- CaratLine.insert(i+1, NumSpaces, CaratLine[i] == '~' ? '~' : ' ');
+ // Insert spaces or ~'s into CaretLine.
+ CaretLine.insert(i+1, NumSpaces, CaretLine[i] == '~' ? '~' : ' ');
}
- // Finally, remove any blank spaces from the end of CaratLine.
- while (CaratLine[CaratLine.size()-1] == ' ')
- CaratLine.erase(CaratLine.end()-1);
+ // Finally, remove any blank spaces from the end of CaretLine.
+ while (CaretLine[CaretLine.size()-1] == ' ')
+ CaretLine.erase(CaretLine.end()-1);
// Emit what we have computed.
OS << SourceLine << "\n";
- OS << CaratLine << "\n";
+ OS << CaretLine << "\n";
}
}