On Oct 17, 2012, at 6:04 PM, Craig Topper <[email protected]> wrote:

> This patch uses the line number cache to find the start of the line instead 
> of searching backwards for it. This helps performance in cases where the line 
> is long and have just called getLineNumber for the same position.

This only helps when the FilePos is exactly the same as the FilePos that went 
to getLineNumber:

+  // 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 && LastLineNoFilePos == (FilePos + 1)) {

Why not simply check that FilePos > SourceLineCache[LastLineNoResult - 1] and < 
SourceLineCache[LastLineNoResult], so anything on the most-recently-queried 
line can be handled efficiently?

        - Doug

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to