Commit 90b4f5c9 authored by hjk's avatar hjk
Browse files

C++: Reduce calls to translationUnit->tokenCount()



Change-Id: I59527ded34873286072be51c6a141dffcbf93406
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent ad9081e3
......@@ -6440,10 +6440,11 @@ void Parser::rewind(unsigned cursor)
fprintf(stderr, "! rewinding from token %d to token %d\n", _tokenIndex, cursor);
#endif
if (cursor < _translationUnit->tokenCount())
const int n = _translationUnit->tokenCount();
if (cursor < n)
_tokenIndex = cursor;
else
_tokenIndex = _translationUnit->tokenCount() - 1;
_tokenIndex = n - 1;
}
void Parser::warning(unsigned index, const char *format, ...)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment