diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 6e83b7aa3441b..68dc1bc4a40a0 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1065,7 +1065,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, if (getLangOpts().CPlusPlus) { // Avoid the unnecessary parse-time lookup in the common case // where the syntax forbids a type. - const Token &Next = NextToken(); + Token Next = NextToken(); if (Next.is(tok::ellipsis) && Tok.is(tok::identifier) && GetLookAheadToken(2).is(tok::l_square)) { @@ -1081,9 +1081,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, // If this identifier was reverted from a token ID, and the next token // is a parenthesis, this is likely to be a use of a type trait. Check // those tokens. - if (Next.is(tok::l_paren) && - Tok.is(tok::identifier) && - Tok.getIdentifierInfo()->hasRevertedTokenIDToIdentifier()) { + else if (Next.is(tok::l_paren) && Tok.is(tok::identifier) && + Tok.getIdentifierInfo()->hasRevertedTokenIDToIdentifier()) { IdentifierInfo *II = Tok.getIdentifierInfo(); // Build up the mapping of revertible type traits, for future use. if (RevertibleTypeTraits.empty()) { @@ -1170,9 +1169,9 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, } } - if ((!ColonIsSacred && Next.is(tok::colon)) || - Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren, - tok::l_brace)) { + else if ((!ColonIsSacred && Next.is(tok::colon)) || + Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren, + tok::l_brace)) { // If TryAnnotateTypeOrScopeToken annotates the token, tail recurse. if (TryAnnotateTypeOrScopeToken()) return ExprError();