Use Token::isOneOf method in Parser.

Summary: Easier to read and possibly optimize.

Reviewers: rsmith, sepavloff

Reviewed By: sepavloff

Subscribers: sepavloff, cfe-commits

Differential Revision: https://reviews.llvm.org/D36701

llvm-svn: 325352
This commit is contained in:
Frederich Munch 2018-02-16 16:07:33 +00:00
parent e145c1d44f
commit af2aee930f
1 changed files with 3 additions and 3 deletions

View File

@ -379,15 +379,15 @@ private:
/// isTokenParen - Return true if the cur token is '(' or ')'. /// isTokenParen - Return true if the cur token is '(' or ')'.
bool isTokenParen() const { bool isTokenParen() const {
return Tok.getKind() == tok::l_paren || Tok.getKind() == tok::r_paren; return Tok.isOneOf(tok::l_paren, tok::r_paren);
} }
/// isTokenBracket - Return true if the cur token is '[' or ']'. /// isTokenBracket - Return true if the cur token is '[' or ']'.
bool isTokenBracket() const { bool isTokenBracket() const {
return Tok.getKind() == tok::l_square || Tok.getKind() == tok::r_square; return Tok.isOneOf(tok::l_square, tok::r_square);
} }
/// isTokenBrace - Return true if the cur token is '{' or '}'. /// isTokenBrace - Return true if the cur token is '{' or '}'.
bool isTokenBrace() const { bool isTokenBrace() const {
return Tok.getKind() == tok::l_brace || Tok.getKind() == tok::r_brace; return Tok.isOneOf(tok::l_brace, tok::r_brace);
} }
/// isTokenStringLiteral - True if this token is a string-literal. /// isTokenStringLiteral - True if this token is a string-literal.
bool isTokenStringLiteral() const { bool isTokenStringLiteral() const {