File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2304,8 +2304,9 @@ class Preprocessor {
23042304
23052305 // / Check whether the next pp-token is one of the specificed token kind. this
23062306 // / method should have no observable side-effect on the lexed tokens.
2307- template <typename ... Ts>
2308- bool isNextPPTokenOneOf (tok::TokenKind K, Ts... Ks) {
2307+ template <typename ... Ts> bool isNextPPTokenOneOf (Ts... Ks) {
2308+ static_assert (sizeof ...(Ts) > 0 ,
2309+ " requires at least one tok::TokenKind specified" );
23092310 // Do some quick tests for rejection cases.
23102311 std::optional<Token> Val;
23112312 if (CurLexer)
@@ -2336,7 +2337,7 @@ class Preprocessor {
23362337
23372338 // Okay, we found the token and return. Otherwise we found the end of the
23382339 // translation unit.
2339- return Val->isOneOf (K, Ks...);
2340+ return Val->isOneOf (Ks...);
23402341 }
23412342
23422343private:
Original file line number Diff line number Diff line change @@ -101,8 +101,10 @@ class Token {
101101 // / "if (Tok.is(tok::l_brace)) {...}".
102102 bool is (tok::TokenKind K) const { return Kind == K; }
103103 bool isNot (tok::TokenKind K) const { return Kind != K; }
104- template <typename ... Ts> bool isOneOf (tok::TokenKind K1, Ts... Ks) const {
105- return is (K1) || (is (Ks) || ...);
104+ template <typename ... Ts> bool isOneOf (Ts... Ks) const {
105+ static_assert (sizeof ...(Ts) > 0 ,
106+ " requires at least one tok::TokenKind specified" );
107+ return (is (Ks) || ...);
106108 }
107109
108110 // / Return true if this is a raw identifier (when lexing
You can’t perform that action at this time.
0 commit comments