From 7bd88aa620406ab99547169b973de085785a0ca2 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 13 Jan 2009 22:16:45 +0000 Subject: [PATCH] Fix corner cases in PTH getSpelling() binary search. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62187 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/PTHLexer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index 4a84f9b3af..c5fc6f3da7 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -400,6 +400,9 @@ unsigned PTHSpellingSearch::getSpellingBinarySearch(unsigned fpos, } if (TokOffset < fpos) { + if (i == min) + break; + min = i; continue; }