[PATCH] D69218: [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 21 06:31:20 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/lib/ASTMatchers/Dynamic/Registry.cpp:182
   REGISTER_MATCHER(cxxConversionDecl);
+  REGISTER_MATCHER(cxxBaseSpecifier);
   REGISTER_MATCHER(cxxCtorInitializer);
----------------
Please keep this list sorted alphabetically.


================
Comment at: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:329
+  EXPECT_TRUE(matches("class X {}; class Y : X {};", ClassHasBaseClassX));
+  EXPECT_TRUE(notMatches("class Z {}; class Y : Z {};", ClassHasBaseClassX));
+}
----------------
I'd like to see another test along these lines:
```
struct Base {};
struct Intermediate : Base {};
struct Derived : Intermediate {};
```
Where we test that `Derived` does not have a direct base relationship with `Base`, but does with `hasAnyBase`.


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

https://reviews.llvm.org/D69218



More information about the cfe-commits mailing list