This revision was automatically updated to reflect the committed changes. Closed by commit rL367759: Use switch instead of series of comparisons (authored by sepavloff, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D65670?vs=213100&id=213192#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65670/new/ https://reviews.llvm.org/D65670 Files: cfe/trunk/include/clang/Basic/TokenKinds.h cfe/trunk/lib/Basic/TokenKinds.cpp Index: cfe/trunk/include/clang/Basic/TokenKinds.h =================================================================== --- cfe/trunk/include/clang/Basic/TokenKinds.h +++ cfe/trunk/include/clang/Basic/TokenKinds.h @@ -90,13 +90,7 @@ } /// Return true if this is any of tok::annot_* kinds. -inline bool isAnnotation(TokenKind K) { -#define ANNOTATION(NAME) \ - if (K == tok::annot_##NAME) \ - return true; -#include "clang/Basic/TokenKinds.def" - return false; -} +bool isAnnotation(TokenKind K); /// Return true if this is an annotation token representing a pragma. bool isPragmaAnnotation(TokenKind K); Index: cfe/trunk/lib/Basic/TokenKinds.cpp =================================================================== --- cfe/trunk/lib/Basic/TokenKinds.cpp +++ cfe/trunk/lib/Basic/TokenKinds.cpp @@ -46,6 +46,16 @@ return nullptr; } +bool tok::isAnnotation(TokenKind Kind) { + switch (Kind) { +#define ANNOTATION(X) case annot_ ## X: return true; +#include "clang/Basic/TokenKinds.def" + default: + break; + } + return false; +} + bool tok::isPragmaAnnotation(TokenKind Kind) { switch (Kind) { #define PRAGMA_ANNOTATION(X) case annot_ ## X: return true;
Index: cfe/trunk/include/clang/Basic/TokenKinds.h =================================================================== --- cfe/trunk/include/clang/Basic/TokenKinds.h +++ cfe/trunk/include/clang/Basic/TokenKinds.h @@ -90,13 +90,7 @@ } /// Return true if this is any of tok::annot_* kinds. -inline bool isAnnotation(TokenKind K) { -#define ANNOTATION(NAME) \ - if (K == tok::annot_##NAME) \ - return true; -#include "clang/Basic/TokenKinds.def" - return false; -} +bool isAnnotation(TokenKind K); /// Return true if this is an annotation token representing a pragma. bool isPragmaAnnotation(TokenKind K); Index: cfe/trunk/lib/Basic/TokenKinds.cpp =================================================================== --- cfe/trunk/lib/Basic/TokenKinds.cpp +++ cfe/trunk/lib/Basic/TokenKinds.cpp @@ -46,6 +46,16 @@ return nullptr; } +bool tok::isAnnotation(TokenKind Kind) { + switch (Kind) { +#define ANNOTATION(X) case annot_ ## X: return true; +#include "clang/Basic/TokenKinds.def" + default: + break; + } + return false; +} + bool tok::isPragmaAnnotation(TokenKind Kind) { switch (Kind) { #define PRAGMA_ANNOTATION(X) case annot_ ## X: return true;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits