aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-03 23:04:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-03 23:04:40 +0000
commit1ef29d217ef9084bca57fe31e0d1541efa6d120a (patch)
treead246b971a3dbb3101ff3c590203939aff5026a8 /lib/Frontend/TextDiagnosticPrinter.cpp
parent6fdca0e1f8352a102f4f0cea0dc29c2209182b15 (diff)
Fix an infinite loop in diagnostic printing.
- The diagnostic is still poor, however. Doug, can you investigate? - Improved the test case to not depend on the file name, now it can be extended to actually check the formatting of the diagnostics (I'm hoping grep -A is portable here). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 62446f3300..95171604d3 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -168,8 +168,7 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
bool ExpandedRegion = false;
// Move the start of the interesting region left until we've
// pulled in something else interesting.
- if (CaretStart && !StartIsFixed &&
- CaretEnd - CaretStart < TargetColumns) {
+ if (CaretStart && !StartIsFixed) {
unsigned NewStart = CaretStart;
bool BadStart = false;
@@ -223,8 +222,7 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
// Move the end of the interesting region right until we've
// pulled in something else interesting.
- if (CaretEnd != SourceLength &&
- CaretEnd - CaretStart < TargetColumns) {
+ if (CaretEnd != SourceLength) {
unsigned NewEnd = CaretEnd;
// Skip over any whitespace we see here; we're looking for
@@ -240,10 +238,10 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
CaretEnd = NewEnd;
ExpandedRegion = true;
}
-
- if (!ExpandedRegion)
- break;
}
+
+ if (!ExpandedRegion)
+ break;
}
// [CaretStart, CaretEnd) is the slice we want. Update the various