[PATCH] D24361: hasDeclaration(qualType(...)) matcher should unwrap ElaboratedType and TemplateSpecializationType

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 25 20:40:41 PDT 2016

klimek added inline comments.

Comment at: unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:2119
@@ +2118,3 @@
+      "template <typename U>\n"
+      "void Function(Namespace::Template<U> param) {\n"
+      "  param.Method();\n"
Given your use case: why do we need hasDeclaration here at all?
I'd have expected this working with just matching on the nested name specifier of the type instead of saying hasDeclaration on the template type.
Btw, if you add a type alias for a class not in the namespace into the namespace (typedef / using), do you wan that to rename or not? :)

I'd personally probably have expected (2), but I'm never sure in these cases without playing around with more test cases...


More information about the cfe-commits mailing list