Hi doug.gregor,
It fixes dozen of failures with --vg.
I have no idea whether it would be right thing. Or, in ComputeLineNumbers(),
should LineOffsets have a sentinel in its tail?
http://llvm-reviews.chandlerc.com/D217
Files:
clang/lib/Basic/SourceManager.cpp
Index: clang/lib/Basic/SourceManager.cpp
===================================================================
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -1032,6 +1032,7 @@
// See if we just calculated the line number for this FilePos and can use
// that to lookup the start of the line instead of searching for it.
if (LastLineNoFileIDQuery == FID &&
+ LastLineNoResult < LastLineNoContentCache->NumLines &&
LastLineNoContentCache->SourceLineCache != 0) {
unsigned *SourceLineCache = LastLineNoContentCache->SourceLineCache;
unsigned LineStart = SourceLineCache[LastLineNoResult - 1];
Index: clang/lib/Basic/SourceManager.cpp
===================================================================
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -1032,6 +1032,7 @@
// See if we just calculated the line number for this FilePos and can use
// that to lookup the start of the line instead of searching for it.
if (LastLineNoFileIDQuery == FID &&
+ LastLineNoResult < LastLineNoContentCache->NumLines &&
LastLineNoContentCache->SourceLineCache != 0) {
unsigned *SourceLineCache = LastLineNoContentCache->SourceLineCache;
unsigned LineStart = SourceLineCache[LastLineNoResult - 1];
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits