Skip to content

Commit 10531cd

Browse files
authored
Merge pull request #5829 from bitjammer/syntax
2 parents 4cd3aad + 430c0ab commit 10531cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/IDE/Formatting.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,12 +897,13 @@ class TokenInfoCollector {
897897
if (Line == 0)
898898
return TokenInfo();
899899
Comparator Comp(SM);
900-
auto LineMatch = [this] (const syntax::Token &T, unsigned Line) {
901-
return T != *Tokens.end() && SM.getLineNumber(T.getLoc()) == Line;
900+
auto LineMatch = [this] (const decltype(Tokens)::iterator T,
901+
unsigned Line) {
902+
return T != Tokens.end() && SM.getLineNumber(T->getLoc()) == Line;
902903
};
903904
auto TargetIt = std::lower_bound(Tokens.begin(), Tokens.end(), Line, Comp);
904905
auto LineBefore = std::lower_bound(Tokens.begin(), TargetIt, Line - 1, Comp);
905-
if (LineMatch(*TargetIt, Line) && LineMatch(*LineBefore, Line - 1))
906+
if (LineMatch(TargetIt, Line) && LineMatch(LineBefore, Line - 1))
906907
return TokenInfo(*TargetIt, *LineBefore);
907908
return TokenInfo();
908909
}

0 commit comments

Comments
 (0)