[clang] a06f000 - [clang][NFC] Remove two hard-coded lists of ArrayTypeTrait and ExpressionTrait

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 12:28:09 PDT 2020


Author: Bruno Ricci
Date: 2020-06-11T20:27:40+01:00
New Revision: a06f000326e3362ffb5634957447dd434abab0f9

URL: https://github.com/llvm/llvm-project/commit/a06f000326e3362ffb5634957447dd434abab0f9
DIFF: https://github.com/llvm/llvm-project/commit/a06f000326e3362ffb5634957447dd434abab0f9.diff

LOG: [clang][NFC] Remove two hard-coded lists of ArrayTypeTrait and ExpressionTrait

These two were missed in 78e636b3f2f0b0487130b31fade4f95ab179a18c.

Added: 
    

Modified: 
    clang/lib/Parse/ParseExprCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index d7947777977a..48277dc85466 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -3649,18 +3649,24 @@ case tok::kw_ ## Spelling: return BTT_ ## Name;
 }
 
 static ArrayTypeTrait ArrayTypeTraitFromTokKind(tok::TokenKind kind) {
-  switch(kind) {
-  default: llvm_unreachable("Not a known binary type trait");
-  case tok::kw___array_rank:                 return ATT_ArrayRank;
-  case tok::kw___array_extent:               return ATT_ArrayExtent;
+  switch (kind) {
+  default:
+    llvm_unreachable("Not a known array type trait");
+#define ARRAY_TYPE_TRAIT(Spelling, Name, Key)                                  \
+  case tok::kw_##Spelling:                                                     \
+    return ATT_##Name;
+#include "clang/Basic/TokenKinds.def"
   }
 }
 
 static ExpressionTrait ExpressionTraitFromTokKind(tok::TokenKind kind) {
-  switch(kind) {
-  default: llvm_unreachable("Not a known unary expression trait.");
-  case tok::kw___is_lvalue_expr:             return ET_IsLValueExpr;
-  case tok::kw___is_rvalue_expr:             return ET_IsRValueExpr;
+  switch (kind) {
+  default:
+    llvm_unreachable("Not a known unary expression trait.");
+#define EXPRESSION_TRAIT(Spelling, Name, Key)                                  \
+  case tok::kw_##Spelling:                                                     \
+    return ET_##Name;
+#include "clang/Basic/TokenKinds.def"
   }
 }
 


        


More information about the cfe-commits mailing list