[PATCH] clang-tidy checker that enforce proper parentheses in macros
Sebastian Edman
sebastian.edman at evidente.se
Wed Jun 10 06:28:22 PDT 2015
================
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);
----------------
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?
http://reviews.llvm.org/D9528
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list