aaron.ballman added inline comments.
================ Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:503 TraversalKind Traversal, BindKind Bind) { + auto ScopedTraversal = TraversingTemplateInstantiationNotSpelledInSource; + ---------------- Please spell this type out rather than use auto. ================ Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:506 + if (const auto *CTSD = Node.get<ClassTemplateSpecializationDecl>()) { + auto SK = CTSD->getSpecializationKind(); + if (SK == TSK_ExplicitInstantiationDeclaration || ---------------- Same here, though this could also be simplified to: ``` ScopedTraversal = (SK == TSK_ExplicitInstantiationDeclaration || SK == TSK_ExplicitInstantiationDefinition); ``` ================ Comment at: clang/unittests/AST/ASTTraverserTest.cpp:1092 + +// Explicit instantiation of template functions do not appear in the AST +template float timesTwo(float); ---------------- Huh, do you have any idea if that's a bug? We have `ClassTemplateSpecializationDecl` and `VarTemplateSpecializationDecl`, but we have `FunctionTemplateSpecializationInfo` that doesn't generate an AST node and no mention of why in the comments that I've spotted yet. ================ Comment at: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:2280 + EXPECT_TRUE(matches(Code, traverse(TK_AsIs, M))); + EXPECT_TRUE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); + } ---------------- Explicitly instantiating a function template in ignore mode returns false, but explicitly instantiating a class template returns true? Is this intentional or just fallout from the lack of explicit instantiation information in the AST for functions? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90763/new/ https://reviews.llvm.org/D90763 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits