Skip to content

Commit fcb6123

Browse files
committedAug 3, 2019
Use switch instead of series of comparisons
This is style correction, no functional changes. Differential Revision: https://reviews.llvm.org/D65670 llvm-svn: 367759
1 parent 71b4476 commit fcb6123

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed
 

‎clang/include/clang/Basic/TokenKinds.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,7 @@ inline bool isLiteral(TokenKind K) {
9090
}
9191

9292
/// Return true if this is any of tok::annot_* kinds.
93-
inline bool isAnnotation(TokenKind K) {
94-
#define ANNOTATION(NAME) \
95-
if (K == tok::annot_##NAME) \
96-
return true;
97-
#include "clang/Basic/TokenKinds.def"
98-
return false;
99-
}
93+
bool isAnnotation(TokenKind K);
10094

10195
/// Return true if this is an annotation token representing a pragma.
10296
bool isPragmaAnnotation(TokenKind K);

‎clang/lib/Basic/TokenKinds.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ const char *tok::getKeywordSpelling(TokenKind Kind) {
4646
return nullptr;
4747
}
4848

49+
bool tok::isAnnotation(TokenKind Kind) {
50+
switch (Kind) {
51+
#define ANNOTATION(X) case annot_ ## X: return true;
52+
#include "clang/Basic/TokenKinds.def"
53+
default:
54+
break;
55+
}
56+
return false;
57+
}
58+
4959
bool tok::isPragmaAnnotation(TokenKind Kind) {
5060
switch (Kind) {
5161
#define PRAGMA_ANNOTATION(X) case annot_ ## X: return true;

0 commit comments

Comments
 (0)
Please sign in to comment.