r266268 - Reorder ASTNodeKind::AllKindInfo to match NodeKindId.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 17:47:40 PDT 2016


Author: alexfh
Date: Wed Apr 13 19:47:40 2016
New Revision: 266268

URL: http://llvm.org/viewvc/llvm-project?rev=266268&view=rev
Log:
Reorder ASTNodeKind::AllKindInfo to match NodeKindId.

Summary:
AllKindInfo is being indexed by NodeKindId, so the order must match.
Extended ASTTypeTraits tests to cover this.

Reviewers: sbenza

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D19059

Modified:
    cfe/trunk/lib/AST/ASTTypeTraits.cpp
    cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp
    cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp
    cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp

Modified: cfe/trunk/lib/AST/ASTTypeTraits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTTypeTraits.cpp?rev=266268&r1=266267&r2=266268&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTTypeTraits.cpp (original)
+++ cfe/trunk/lib/AST/ASTTypeTraits.cpp Wed Apr 13 19:47:40 2016
@@ -22,12 +22,12 @@ namespace ast_type_traits {
 
 const ASTNodeKind::KindInfo ASTNodeKind::AllKindInfo[] = {
   { NKI_None, "<None>" },
-  { NKI_None, "CXXCtorInitializer" },
   { NKI_None, "TemplateArgument" },
-  { NKI_None, "NestedNameSpecifier" },
   { NKI_None, "NestedNameSpecifierLoc" },
   { NKI_None, "QualType" },
   { NKI_None, "TypeLoc" },
+  { NKI_None, "CXXCtorInitializer" },
+  { NKI_None, "NestedNameSpecifier" },
   { NKI_None, "Decl" },
 #define DECL(DERIVED, BASE) { NKI_##BASE, #DERIVED "Decl" },
 #include "clang/AST/DeclNodes.inc"

Modified: cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp?rev=266268&r1=266267&r2=266268&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp Wed Apr 13 19:47:40 2016
@@ -107,10 +107,21 @@ TEST(ASTNodeKind, UnknownKind) {
 }
 
 TEST(ASTNodeKind, Name) {
-  EXPECT_EQ("Decl", DNT<Decl>().asStringRef());
-  EXPECT_EQ("CallExpr", DNT<CallExpr>().asStringRef());
-  EXPECT_EQ("ConstantArrayType", DNT<ConstantArrayType>().asStringRef());
   EXPECT_EQ("<None>", ASTNodeKind().asStringRef());
+#define VERIFY_NAME(Node) EXPECT_EQ(#Node, DNT<Node>().asStringRef());
+  VERIFY_NAME(TemplateArgument);
+  VERIFY_NAME(NestedNameSpecifierLoc);
+  VERIFY_NAME(QualType);
+  VERIFY_NAME(TypeLoc);
+  VERIFY_NAME(CXXCtorInitializer);
+  VERIFY_NAME(NestedNameSpecifier);
+  VERIFY_NAME(Decl);
+  VERIFY_NAME(CXXRecordDecl);
+  VERIFY_NAME(Stmt);
+  VERIFY_NAME(CallExpr);
+  VERIFY_NAME(Type);
+  VERIFY_NAME(ConstantArrayType);
+#undef VERIFY_NAME
 }
 
 TEST(DynTypedNode, DeclSourceRange) {

Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp?rev=266268&r1=266267&r2=266268&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Wed Apr 13 19:47:40 2016
@@ -320,7 +320,7 @@ TEST(ParserTest, CompletionNamedValues)
   EXPECT_EQ("arent(", Comps[2].TypedText);
   EXPECT_EQ(
       "Matcher<Decl> "
-      "hasParent(Matcher<TemplateArgument|NestedNameSpecifierLoc|Decl|...>)",
+      "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)",
       Comps[2].MatcherDecl);
 }
 

Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp?rev=266268&r1=266267&r2=266268&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp Wed Apr 13 19:47:40 2016
@@ -449,26 +449,25 @@ TEST_F(RegistryTest, Completion) {
   // Overloaded
   EXPECT_TRUE(hasCompletion(
       Comps, "hasParent(",
-      "Matcher<TemplateArgument|NestedNameSpecifierLoc|Decl|...> "
-      "hasParent(Matcher<TemplateArgument|NestedNameSpecifierLoc|Decl|...>)"));
+      "Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...> "
+      "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)"));
   // Variadic.
   EXPECT_TRUE(hasCompletion(Comps, "whileStmt(",
                             "Matcher<Stmt> whileStmt(Matcher<WhileStmt>...)"));
   // Polymorphic.
   EXPECT_TRUE(hasCompletion(
       Comps, "hasDescendant(",
-      "Matcher<TemplateArgument|NestedNameSpecifier|NestedNameSpecifierLoc|...>"
-      " hasDescendant(Matcher<TemplateArgument|NestedNameSpecifier|"
-      "NestedNameSpecifierLoc|...>)"));
+      "Matcher<NestedNameSpecifierLoc|QualType|TypeLoc|...> "
+      "hasDescendant(Matcher<NestedNameSpecifierLoc|QualType|TypeLoc|...>)"));
 
   CompVector WhileComps = getCompletions("whileStmt", 0);
 
   EXPECT_TRUE(hasCompletion(WhileComps, "hasBody(",
                             "Matcher<WhileStmt> hasBody(Matcher<Stmt>)"));
-  EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(",
-                            "Matcher<Stmt> "
-                            "hasParent(Matcher<TemplateArgument|"
-                            "NestedNameSpecifierLoc|Decl|...>)"));
+  EXPECT_TRUE(hasCompletion(
+      WhileComps, "hasParent(",
+      "Matcher<Stmt> "
+      "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)"));
   EXPECT_TRUE(
       hasCompletion(WhileComps, "allOf(", "Matcher<T> allOf(Matcher<T>...)"));
 




More information about the cfe-commits mailing list