================
Comment at: include/clang/Lex/Token.h:97
@@ -96,1 +96,3 @@
   bool isNot(tok::TokenKind K) const { return Kind != K; }
+  bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const {
+    return is(K1) || is(K2);
----------------
edse wrote:
> alexfh wrote:
> > Thanks! This should go in a separate patch though. And I would appreciate 
> > if you updated FormatToken::isOneOf to just redirect to this implementation.
> Separate patch is no problem, but redirecting that is a simple word.. I've 
> come up with something like this.
> 
> ```
> template<> bool isOneOf<tok::TokenKind, tok::TokenKind>
> (tok::TokenKind K1, tok::TokenKind K2) const {
>   return Tok.isOneOf(K1, K2);
> }
> ```
> but the variadic function is more tricky, I always get the //function 
> template partial specialization is not allowed// warning, and to just 
> redirect one of the functions is imho not a good idea.
> 
> My proposal is to leave this as is, do you have a comment?
> 
It would be nice as a separate patch as it changes a totally different part of 
the project (residing in a different part of the repository, btw).

As for `FormatToken::isOneOf`, I missed that it also works for other 
`FormatToken::is` overloads (taking `TokenType` and `IdentifierInfo *`), so it 
doesn't make sense to redirect it.

http://reviews.llvm.org/D9528

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to