[PATCH] D36702: Make Parser::Consume*Token methods public.
Frederich Munch via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 11:15:55 PDT 2017
marsupial created this revision.
The fix in r303372 exposed a problem when using **Parser::ConsumeToken** from client code in DEBUG.
**ConsumeToken** will assert for all **isTokenSpecial()** cases, but there is no way to call the proper method.
The isToken methods are just convenient.
https://reviews.llvm.org/D36702
Files:
include/clang/Parse/Parser.h
Index: include/clang/Parse/Parser.h
===================================================================
--- include/clang/Parse/Parser.h
+++ include/clang/Parse/Parser.h
@@ -348,11 +348,6 @@
return Actions.getNullabilityKeyword(nullability);
}
-private:
- //===--------------------------------------------------------------------===//
- // Low-Level token peeking and consumption methods.
- //
-
/// isTokenParen - Return true if the cur token is '(' or ')'.
bool isTokenParen() const {
return Tok.isOneOf(tok::l_paren, tok::r_paren);
@@ -375,19 +370,6 @@
isTokenBrace() || Tok.is(tok::code_completion) || Tok.isAnnotation();
}
- /// \brief Returns true if the current token is '=' or is a type of '='.
- /// For typos, give a fixit to '='
- bool isTokenEqualOrEqualTypo();
-
- /// \brief Return the current token to the token stream and make the given
- /// token the current token.
- void UnconsumeToken(Token &Consumed) {
- Token Next = Tok;
- PP.EnterToken(Consumed);
- PP.Lex(Tok);
- PP.EnterToken(Next);
- }
-
/// ConsumeAnyToken - Dispatch to the right Consume* method based on the
/// current token type. This should only be used in cases where the type of
/// the token really isn't known, e.g. in error recovery.
@@ -481,6 +463,24 @@
return PrevTokLocation;
}
+private:
+ //===--------------------------------------------------------------------===//
+ // Low-Level token peeking and consumption methods.
+ //
+
+ /// \brief Returns true if the current token is '=' or is a type of '='.
+ /// For typos, give a fixit to '='
+ bool isTokenEqualOrEqualTypo();
+
+ /// \brief Return the current token to the token stream and make the given
+ /// token the current token.
+ void UnconsumeToken(Token &Consumed) {
+ Token Next = Tok;
+ PP.EnterToken(Consumed);
+ PP.Lex(Tok);
+ PP.EnterToken(Next);
+ }
+
///\ brief When we are consuming a code-completion token without having
/// matched specific position in the grammar, provide code-completion results
/// based on context.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36702.111036.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170814/14d52b99/attachment.bin>
More information about the cfe-commits
mailing list