hokein added a comment.

thanks, looks mostly good, I think we can simplify the unittest further.



================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:51
       Type = Type->getPointeeType();
+    if (const TemplateSpecializationType *TST =
+            Type->getAs<TemplateSpecializationType>()) {
----------------
nit: we can use `const auto*` here as the type is explicitly spelled in the 
`getAs<XXX>`


================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:52
+    if (const TemplateSpecializationType *TST =
+            Type->getAs<TemplateSpecializationType>()) {
+      return TST->getTemplateName().getAsTemplateDecl();
----------------
nit: remove the {} around the if statement


================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:74
   }
 
+  bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) {
----------------
nit: I will remove this blank line, to make `VisitMemberExpr` and 
`VisitCXXDependentScopeMemberExpr` group together as they both achieve the same 
goal.


================
Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:207
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
+           "template<typename T> void k(Base<T>* t) { t->^method(); }");
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
----------------
I think keeping the above 3 test cases is enough, I would probably add them to 
the exiting MemberExprs test (with a comment saying this is dependent-type 
case).


================
Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:209
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
+           "template<typename T> void k() { Base<T> t; t.^method(); }");
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
----------------
I think we can remove this test, this test duplicates the first test


================
Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:211
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
+           "template<typename T> void k() { Base<T>* t; t->^method(); }");
+  testWalk("template<typename T> struct $explicit^Base { void method(); };",
----------------
And this case as well


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139409/new/

https://reviews.llvm.org/D139409

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to