Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."
Putting DynTypedNode in the ParentMap bloats its memory foot print.
Before the void* key had 8 bytes, now we're at 40 bytes per key which
can mean multiple gigabytes increase for large ASTs and this count
doesn't even include all the added TypeLoc nodes. Revert until I come
up with a better data structure.
This reverts commit r250831.
llvm-svn: 250889
diff --git a/clang/unittests/AST/ASTContextParentMapTest.cpp b/clang/unittests/AST/ASTContextParentMapTest.cpp
index b1d7db41..94e9735 100644
--- a/clang/unittests/AST/ASTContextParentMapTest.cpp
+++ b/clang/unittests/AST/ASTContextParentMapTest.cpp
@@ -38,19 +38,6 @@
ifStmt(hasParent(compoundStmt()))));
}
-TEST(GetParents, ReturnsParentForTypeLoc) {
- MatchVerifier<TypeLoc> Verifier;
- EXPECT_TRUE(
- Verifier.match("namespace a { class b {}; } void f(a::b) {}",
- typeLoc(hasParent(typeLoc(hasParent(functionDecl()))))));
-}
-
-TEST(GetParents, ReturnsParentForNestedNameSpecifierLoc) {
- MatchVerifier<NestedNameSpecifierLoc> Verifier;
- EXPECT_TRUE(Verifier.match("namespace a { class b {}; } void f(a::b) {}",
- nestedNameSpecifierLoc(hasParent(typeLoc()))));
-}
-
TEST(GetParents, ReturnsParentInsideTemplateInstantiations) {
MatchVerifier<Decl> DeclVerifier;
EXPECT_TRUE(DeclVerifier.match(
diff --git a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
index 2c94a72..ef66a81 100644
--- a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -318,8 +318,7 @@
Comps[1].MatcherDecl);
EXPECT_EQ("arent(", Comps[2].TypedText);
- EXPECT_EQ("Matcher<Decl> "
- "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)",
+ EXPECT_EQ("Matcher<Decl> hasParent(Matcher<Decl|Stmt>)",
Comps[2].MatcherDecl);
}
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index 9b562bc..ca1dfef 100644
--- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -447,10 +447,8 @@
TEST_F(RegistryTest, Completion) {
CompVector Comps = getCompletions();
// Overloaded
- EXPECT_TRUE(hasCompletion(Comps, "hasParent(",
- "Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...> "
- "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|"
- "Decl|...>)"));
+ EXPECT_TRUE(hasCompletion(
+ Comps, "hasParent(", "Matcher<Decl|Stmt> hasParent(Matcher<Decl|Stmt>)"));
// Variadic.
EXPECT_TRUE(hasCompletion(Comps, "whileStmt(",
"Matcher<Stmt> whileStmt(Matcher<WhileStmt>...)"));
@@ -465,10 +463,8 @@
EXPECT_TRUE(hasCompletion(WhileComps, "hasBody(",
"Matcher<WhileStmt> hasBody(Matcher<Stmt>)"));
- EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(", "Matcher<Stmt> "
- "hasParent(Matcher<"
- "NestedNameSpecifierLoc|"
- "TypeLoc|Decl|...>)"));
+ EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(",
+ "Matcher<Stmt> hasParent(Matcher<Decl|Stmt>)"));
EXPECT_TRUE(
hasCompletion(WhileComps, "allOf(", "Matcher<T> allOf(Matcher<T>...)"));