// Let the actions module handle the identifier.
ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
*IdTok.getIdentifierInfo(),
- Tok.getKind() == tok::l_paren);
+ Tok.is(tok::l_paren));
// Because we have to parse an entire cast-expression before starting the
// ParseRHSOfBinaryExpression method (which parses any trailing binops), we
// Let the actions module handle the identifier.
ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
*IdTok.getIdentifierInfo(),
- Tok.getKind() == tok::l_paren);
+ Tok.is(tok::l_paren));
// Because we have to parse an entire cast-expression before starting the
// ParseRHSOfBinaryExpression method (which parses any trailing binops), we
// Special case handling for the ternary operator.
ExprResult TernaryMiddle(true);
if (NextTokPrec == prec::Conditional) {
- if (Tok.getKind() != tok::colon) {
+ if (Tok.isNot(tok::colon)) {
// Handle this production specially:
// logical-OR-expression '?' expression ':' conditional-expression
// In particular, the RHS of the '?' is 'expression', not
Diag(Tok, diag::ext_gnu_conditional_expr);
}
- if (Tok.getKind() != tok::colon) {
+ if (Tok.isNot(tok::colon)) {
Diag(Tok, diag::err_expected_colon);
Diag(OpToken, diag::err_matching, "?");
Actions.DeleteExpr(LHS.Val);
// not.
IdentifierInfo &II = *Tok.getIdentifierInfo();
SourceLocation L = ConsumeToken();
- Res = Actions.ActOnIdentifierExpr(CurScope, L, II,
- Tok.getKind() == tok::l_paren);
+ Res = Actions.ActOnIdentifierExpr(CurScope, L, II, Tok.is(tok::l_paren));
// These can be followed by postfix-expr pieces.
return ParsePostfixExpressionSuffix(Res);
}
return ParseSizeofAlignofExpression();
case tok::ampamp: { // unary-expression: '&&' identifier
SourceLocation AmpAmpLoc = ConsumeToken();
- if (Tok.getKind() != tok::identifier) {
+ if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
return ExprResult(true);
}
SourceLocation RLoc = Tok.getLocation();
- if (!LHS.isInvalid && !Idx.isInvalid && Tok.getKind() == tok::r_square)
+ if (!LHS.isInvalid && !Idx.isInvalid && Tok.is(tok::r_square))
LHS = Actions.ActOnArraySubscriptExpr(LHS.Val, Loc, Idx.Val, RLoc);
else
LHS = ExprResult(true);
Loc = ConsumeParen();
- if (Tok.getKind() != tok::r_paren) {
+ if (Tok.isNot(tok::r_paren)) {
while (1) {
ExprResult ArgExpr = ParseAssignmentExpression();
if (ArgExpr.isInvalid) {
} else
ArgExprs.push_back(ArgExpr.Val);
- if (Tok.getKind() != tok::comma)
+ if (Tok.isNot(tok::comma))
break;
// Move to the next argument, remember where the comma was.
CommaLocs.push_back(ConsumeToken());
}
// Match the ')'.
- if (!LHS.isInvalid && Tok.getKind() == tok::r_paren) {
+ if (!LHS.isInvalid && Tok.is(tok::r_paren)) {
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
LHS = Actions.ActOnCallExpr(LHS.Val, Loc, &ArgExprs[0], ArgExprs.size(),
tok::TokenKind OpKind = Tok.getKind();
SourceLocation OpLoc = ConsumeToken(); // Eat the "." or "->" token.
- if (Tok.getKind() != tok::identifier) {
+ if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
return ExprResult(true);
}
/// [GNU] '__alignof' unary-expression
/// [GNU] '__alignof' '(' type-name ')'
Parser::ExprResult Parser::ParseSizeofAlignofExpression() {
- assert((Tok.getKind() == tok::kw_sizeof ||
- Tok.getKind() == tok::kw___alignof) &&
+ assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof)) &&
"Not a sizeof/alignof expression!");
Token OpTok = Tok;
ConsumeToken();
// If the operand doesn't start with an '(', it must be an expression.
ExprResult Operand;
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Operand = ParseCastExpression(true);
} else {
// If it starts with a '(', we know that it is either a parenthesized
// sizeof/alignof a type. Otherwise, it is sizeof/alignof an expression.
if (ExprType == CastExpr) {
return Actions.ActOnSizeOfAlignOfTypeExpr(OpTok.getLocation(),
- OpTok.getKind() == tok::kw_sizeof,
+ OpTok.is(tok::kw_sizeof),
LParenLoc, CastTy, RParenLoc);
}
}
SourceLocation StartLoc = ConsumeToken(); // Eat the builtin identifier.
// All of these start with an open paren.
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, BuiltinII->getName());
return ExprResult(true);
}
return ExprResult(true);
// We must have at least one identifier here.
- if (Tok.getKind() != tok::identifier) {
+ if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
SkipUntil(tok::r_paren);
return true;
Comps.back().LocStart = Comps.back().LocEnd = ConsumeToken();
while (1) {
- if (Tok.getKind() == tok::period) {
+ if (Tok.is(tok::period)) {
// offsetof-member-designator: offsetof-member-designator '.' identifier
Comps.push_back(Action::OffsetOfComponent());
Comps.back().isBrackets = false;
Comps.back().LocStart = ConsumeToken();
- if (Tok.getKind() != tok::identifier) {
+ if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
SkipUntil(tok::r_paren);
return true;
Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
Comps.back().LocEnd = ConsumeToken();
- } else if (Tok.getKind() == tok::l_square) {
+ } else if (Tok.is(tok::l_square)) {
// offsetof-member-designator: offsetof-member-design '[' expression ']'
Comps.push_back(Action::OffsetOfComponent());
Comps.back().isBrackets = true;
Comps.back().LocEnd =
MatchRHSPunctuation(tok::r_square, Comps.back().LocStart);
- } else if (Tok.getKind() == tok::r_paren) {
+ } else if (Tok.is(tok::r_paren)) {
Res = Actions.ActOnBuiltinOffsetOf(StartLoc, TypeLoc, Ty, &Comps[0],
Comps.size(), ConsumeParen());
break;
SkipUntil(tok::r_paren);
return Expr2;
}
- if (Tok.getKind() != tok::r_paren) {
+ if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected_rparen);
return ExprResult(true);
}
TypeTy *Ty2 = ParseTypeName();
- if (Tok.getKind() != tok::r_paren) {
+ if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected_rparen);
return ExprResult(true);
}
Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
TypeTy *&CastTy,
SourceLocation &RParenLoc) {
- assert(Tok.getKind() == tok::l_paren && "Not a paren expr!");
+ assert(Tok.is(tok::l_paren) && "Not a paren expr!");
SourceLocation OpenLoc = ConsumeParen();
ExprResult Result(true);
CastTy = 0;
- if (ExprType >= CompoundStmt && Tok.getKind() == tok::l_brace) {
+ if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
Diag(Tok, diag::ext_gnu_statement_expr);
Parser::StmtResult Stmt = ParseCompoundStatement(true);
ExprType = CompoundStmt;
// If the substmt parsed correctly, build the AST node.
- if (!Stmt.isInvalid && Tok.getKind() == tok::r_paren)
+ if (!Stmt.isInvalid && Tok.is(tok::r_paren))
Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.Val, Tok.getLocation());
} else if (ExprType >= CompoundLiteral && isTypeSpecifierQualifier()) {
TypeTy *Ty = ParseTypeName();
// Match the ')'.
- if (Tok.getKind() == tok::r_paren)
+ if (Tok.is(tok::r_paren))
RParenLoc = ConsumeParen();
else
MatchRHSPunctuation(tok::r_paren, OpenLoc);
- if (Tok.getKind() == tok::l_brace) {
+ if (Tok.is(tok::l_brace)) {
if (!getLang().C99) // Compound literals don't exist in C90.
Diag(OpenLoc, diag::ext_c99_compound_literal);
Result = ParseInitializer();
} else {
Result = ParseExpression();
ExprType = SimpleExpr;
- if (!Result.isInvalid && Tok.getKind() == tok::r_paren)
+ if (!Result.isInvalid && Tok.is(tok::r_paren))
Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.Val);
}
if (Result.isInvalid)
SkipUntil(tok::r_paren);
else {
- if (Tok.getKind() == tok::r_paren)
+ if (Tok.is(tok::r_paren))
RParenLoc = ConsumeParen();
else
MatchRHSPunctuation(tok::r_paren, OpenLoc);
default:
if (!OnlyStatement && isDeclarationSpecifier()) {
return Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext));
- } else if (Tok.getKind() == tok::r_brace) {
+ } else if (Tok.is(tok::r_brace)) {
Diag(Tok, diag::err_expected_statement);
return true;
} else {
}
// If we reached this code, the statement must end in a semicolon.
- if (Tok.getKind() == tok::semi) {
+ if (Tok.is(tok::semi)) {
ConsumeToken();
} else {
Diag(Tok, diag::err_expected_semi_after, SemiError);
/// expression[opt] ';'
///
Parser::StmtResult Parser::ParseIdentifierStatement(bool OnlyStatement) {
- assert(Tok.getKind() == tok::identifier && Tok.getIdentifierInfo() &&
+ assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
"Not an identifier!");
Token IdentTok = Tok; // Save the whole token.
ConsumeToken(); // eat the identifier.
// identifier ':' statement
- if (Tok.getKind() == tok::colon) {
+ if (Tok.is(tok::colon)) {
SourceLocation ColonLoc = ConsumeToken();
// Read label attributes, if present.
DeclTy *AttrList = 0;
- if (Tok.getKind() == tok::kw___attribute)
+ if (Tok.is(tok::kw___attribute))
// TODO: save these somewhere.
AttrList = ParseAttributes();
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
- if (Tok.getKind() == tok::semi) {
+ if (Tok.is(tok::semi)) {
// TODO: emit error on 'int;' or 'const enum foo;'.
// if (!DS.isMissingDeclaratorOk()) Diag(...);
if (Res.isInvalid) {
SkipUntil(tok::semi);
return true;
- } else if (Tok.getKind() != tok::semi) {
+ } else if (Tok.isNot(tok::semi)) {
Diag(Tok, diag::err_expected_semi_after, "expression");
SkipUntil(tok::semi);
return true;
/// Note that this does not parse the 'statement' at the end.
///
Parser::StmtResult Parser::ParseCaseStatement() {
- assert(Tok.getKind() == tok::kw_case && "Not a case stmt!");
+ assert(Tok.is(tok::kw_case) && "Not a case stmt!");
SourceLocation CaseLoc = ConsumeToken(); // eat the 'case'.
ExprResult LHS = ParseConstantExpression();
// GNU case range extension.
SourceLocation DotDotDotLoc;
ExprTy *RHSVal = 0;
- if (Tok.getKind() == tok::ellipsis) {
+ if (Tok.is(tok::ellipsis)) {
Diag(Tok, diag::ext_gnu_case_range);
DotDotDotLoc = ConsumeToken();
RHSVal = RHS.Val;
}
- if (Tok.getKind() != tok::colon) {
+ if (Tok.isNot(tok::colon)) {
Diag(Tok, diag::err_expected_colon_after, "'case'");
SkipUntil(tok::colon);
return true;
SourceLocation ColonLoc = ConsumeToken();
// Diagnose the common error "switch (X) { case 4: }", which is not valid.
- if (Tok.getKind() == tok::r_brace) {
+ if (Tok.is(tok::r_brace)) {
Diag(Tok, diag::err_label_end_of_compound_statement);
return true;
}
/// Note that this does not parse the 'statement' at the end.
///
Parser::StmtResult Parser::ParseDefaultStatement() {
- assert(Tok.getKind() == tok::kw_default && "Not a default stmt!");
+ assert(Tok.is(tok::kw_default) && "Not a default stmt!");
SourceLocation DefaultLoc = ConsumeToken(); // eat the 'default'.
- if (Tok.getKind() != tok::colon) {
+ if (Tok.isNot(tok::colon)) {
Diag(Tok, diag::err_expected_colon_after, "'default'");
SkipUntil(tok::colon);
return true;
SourceLocation ColonLoc = ConsumeToken();
// Diagnose the common error "switch (X) {... default: }", which is not valid.
- if (Tok.getKind() == tok::r_brace) {
+ if (Tok.is(tok::r_brace)) {
Diag(Tok, diag::err_label_end_of_compound_statement);
return true;
}
/// [OMP] flush-directive
///
Parser::StmtResult Parser::ParseCompoundStatement(bool isStmtExpr) {
- assert(Tok.getKind() == tok::l_brace && "Not a compount stmt!");
+ assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
// Enter a scope to hold everything within the compound stmt. Compound
// statements can always hold declarations.
// only allowed at the start of a compound stmt regardless of the language.
llvm::SmallVector<StmtTy*, 32> Stmts;
- while (Tok.getKind() != tok::r_brace && Tok.getKind() != tok::eof) {
+ while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
StmtResult R;
- if (Tok.getKind() != tok::kw___extension__) {
+ if (Tok.isNot(tok::kw___extension__)) {
R = ParseStatementOrDeclaration(false);
} else {
// __extension__ can start declarations and it can also be a unary
// operator for expressions. Consume multiple __extension__ markers here
// until we can determine which is which.
SourceLocation ExtLoc = ConsumeToken();
- while (Tok.getKind() == tok::kw___extension__)
+ while (Tok.is(tok::kw___extension__))
ConsumeToken();
// If this is the start of a declaration, parse it as such.
}
// We broke out of the while loop because we found a '}' or EOF.
- if (Tok.getKind() != tok::r_brace) {
+ if (Tok.isNot(tok::r_brace)) {
Diag(Tok, diag::err_expected_rbrace);
return 0;
}
/// 'if' '(' expression ')' statement 'else' statement
///
Parser::StmtResult Parser::ParseIfStatement() {
- assert(Tok.getKind() == tok::kw_if && "Not an if stmt!");
+ assert(Tok.is(tok::kw_if) && "Not an if stmt!");
SourceLocation IfLoc = ConsumeToken(); // eat the 'if'.
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "if");
SkipUntil(tok::semi);
return true;
// C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
- bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
// Read the if condition.
// If it has an else, parse it.
SourceLocation ElseLoc;
StmtResult ElseStmt(false);
- if (Tok.getKind() == tok::kw_else) {
+ if (Tok.is(tok::kw_else)) {
ElseLoc = ConsumeToken();
// C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do
// this if the body isn't a compound statement to avoid push/pop in common
// cases.
- NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
ElseStmt = ParseStatement();
/// switch-statement:
/// 'switch' '(' expression ')' statement
Parser::StmtResult Parser::ParseSwitchStatement() {
- assert(Tok.getKind() == tok::kw_switch && "Not a switch stmt!");
+ assert(Tok.is(tok::kw_switch) && "Not a switch stmt!");
SourceLocation SwitchLoc = ConsumeToken(); // eat the 'switch'.
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "switch");
SkipUntil(tok::semi);
return true;
// C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
- bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
// Read the body statement.
/// while-statement: [C99 6.8.5.1]
/// 'while' '(' expression ')' statement
Parser::StmtResult Parser::ParseWhileStatement() {
- assert(Tok.getKind() == tok::kw_while && "Not a while stmt!");
+ assert(Tok.is(tok::kw_while) && "Not a while stmt!");
SourceLocation WhileLoc = Tok.getLocation();
ConsumeToken(); // eat the 'while'.
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "while");
SkipUntil(tok::semi);
return true;
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
- bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
// Read the body statement.
/// 'do' statement 'while' '(' expression ')' ';'
/// Note: this lets the caller parse the end ';'.
Parser::StmtResult Parser::ParseDoStatement() {
- assert(Tok.getKind() == tok::kw_do && "Not a do stmt!");
+ assert(Tok.is(tok::kw_do) && "Not a do stmt!");
SourceLocation DoLoc = ConsumeToken(); // eat the 'do'.
// C99 6.8.5p5 - In C99, the do statement is a block. This is not
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
- bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
// Read the body statement.
// Pop the body scope if needed.
if (NeedsInnerScope) ExitScope();
- if (Tok.getKind() != tok::kw_while) {
+ if (Tok.isNot(tok::kw_while)) {
ExitScope();
Diag(Tok, diag::err_expected_while);
Diag(DoLoc, diag::err_matching, "do");
}
SourceLocation WhileLoc = ConsumeToken();
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
ExitScope();
Diag(Tok, diag::err_expected_lparen_after, "do/while");
SkipUntil(tok::semi);
/// 'for' '(' expr[opt] ';' expr[opt] ';' expr[opt] ')' statement
/// 'for' '(' declaration expr[opt] ';' expr[opt] ')' statement
Parser::StmtResult Parser::ParseForStatement() {
- assert(Tok.getKind() == tok::kw_for && "Not a for stmt!");
+ assert(Tok.is(tok::kw_for) && "Not a for stmt!");
SourceLocation ForLoc = ConsumeToken(); // eat the 'for'.
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "for");
SkipUntil(tok::semi);
return true;
StmtTy *ThirdPart = 0;
// Parse the first part of the for specifier.
- if (Tok.getKind() == tok::semi) { // for (;
+ if (Tok.is(tok::semi)) { // for (;
// no first part, eat the ';'.
ConsumeToken();
} else if (isDeclarationSpecifier()) { // for (int X = 4;
FirstPart = R.Val;
}
- if (Tok.getKind() == tok::semi) {
+ if (Tok.is(tok::semi)) {
ConsumeToken();
} else {
if (!Value.isInvalid) Diag(Tok, diag::err_expected_semi_for);
}
// Parse the second part of the for specifier.
- if (Tok.getKind() == tok::semi) { // for (...;;
+ if (Tok.is(tok::semi)) { // for (...;;
// no second part.
Value = ExprResult();
} else {
SecondPart = Value.Val;
}
- if (Tok.getKind() == tok::semi) {
+ if (Tok.is(tok::semi)) {
ConsumeToken();
} else {
if (!Value.isInvalid) Diag(Tok, diag::err_expected_semi_for);
}
// Parse the third part of the for specifier.
- if (Tok.getKind() == tok::r_paren) { // for (...;...;)
+ if (Tok.is(tok::r_paren)) { // for (...;...;)
// no third part.
Value = ExprResult();
} else {
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
- bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+ bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
if (NeedsInnerScope) EnterScope(Scope::DeclScope);
// Read the body statement.
/// Note: this lets the caller parse the end ';'.
///
Parser::StmtResult Parser::ParseGotoStatement() {
- assert(Tok.getKind() == tok::kw_goto && "Not a goto stmt!");
+ assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
SourceLocation GotoLoc = ConsumeToken(); // eat the 'goto'.
StmtResult Res;
- if (Tok.getKind() == tok::identifier) {
+ if (Tok.is(tok::identifier)) {
Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(),
Tok.getIdentifierInfo());
ConsumeToken();
- } else if (Tok.getKind() == tok::star && !getLang().NoExtensions) {
+ } else if (Tok.is(tok::star) && !getLang().NoExtensions) {
// GNU indirect goto extension.
Diag(Tok, diag::ext_gnu_indirect_goto);
SourceLocation StarLoc = ConsumeToken();
/// jump-statement:
/// 'return' expression[opt] ';'
Parser::StmtResult Parser::ParseReturnStatement() {
- assert(Tok.getKind() == tok::kw_return && "Not a return stmt!");
+ assert(Tok.is(tok::kw_return) && "Not a return stmt!");
SourceLocation ReturnLoc = ConsumeToken(); // eat the 'return'.
ExprResult R(0);
- if (Tok.getKind() != tok::semi) {
+ if (Tok.isNot(tok::semi)) {
R = ParseExpression();
if (R.isInvalid) { // Skip to the semicolon, but don't consume it.
SkipUntil(tok::semi, false, true);
/// asm-clobbers ',' asm-string-literal
///
Parser::StmtResult Parser::ParseAsmStatement() {
- assert(Tok.getKind() == tok::kw_asm && "Not an asm stmt");
+ assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
ConsumeToken();
DeclSpec DS;
// Remember if this was a volatile asm.
//bool isVolatile = DS.TypeQualifiers & DeclSpec::TQ_volatile;
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "asm");
SkipUntil(tok::r_paren);
return true;
ParseAsmOperandsOpt();
// Parse the clobbers, if present.
- if (Tok.getKind() == tok::colon) {
+ if (Tok.is(tok::colon)) {
ConsumeToken();
if (isTokenStringLiteral()) {
while (1) {
ParseAsmStringLiteral();
- if (Tok.getKind() != tok::comma) break;
+ if (Tok.isNot(tok::comma)) break;
ConsumeToken();
}
}
///
void Parser::ParseAsmOperandsOpt() {
// Only do anything if this operand is present.
- if (Tok.getKind() != tok::colon) return;
+ if (Tok.isNot(tok::colon)) return;
ConsumeToken();
// 'asm-operands' isn't present?
- if (!isTokenStringLiteral() && Tok.getKind() != tok::l_square)
+ if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
return;
while (1) {
// Read the [id] if present.
- if (Tok.getKind() == tok::l_square) {
+ if (Tok.is(tok::l_square)) {
SourceLocation Loc = ConsumeBracket();
- if (Tok.getKind() != tok::identifier) {
+ if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
SkipUntil(tok::r_paren);
return;
ParseAsmStringLiteral();
- if (Tok.getKind() != tok::l_paren) {
+ if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "asm operand");
SkipUntil(tok::r_paren);
return;
}
// Eat the comma and continue parsing if it exists.
- if (Tok.getKind() != tok::comma) return;
+ if (Tok.isNot(tok::comma)) return;
ConsumeToken();
}
}