This patch adds isDirectlyDerivedFrom AST-matcher which is similar to isDerivedFrom but only matches against direct base classes.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
2637 | /*Directly=*/false | |
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
342 | I think these tests are ~enough, given the implementation. |
clang/docs/LibASTMatchersReference.html | ||
---|---|---|
5297 | Did you manually change this? This should be generated from the code, but I don't see this text anywhere in the code comments? |
Thanks for the note, updated the diff with autogenerated LibASTMatcherReference.html.
So, I did like the more exhaustive doc, I thought you'd move it to the code so it also shows up in the generated doc page :) (sorry for not being clearer here)
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
2637 | If you say /*Directly=*/false, you should |
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
2672 | I don't think this assertion is reasonable -- we should instead test this as a predicate and return false if the base name is empty. |
Thanks for the comments!
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
2672 | It's done in the same way as for existing isDerivedFrom and isSameOrDerivedFrom matchers. Maybe it would make sense to change all of them, but I guess it should rather be a separate commit. |
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
2672 | I'm fine with doing it in a follow-up commit, but it should be done (it shouldn't assert on invalid input, only on thought-to-be impossible situations, generally speaking). | |
2682 | You should register this in Registry.cpp as an overload, like we do for isDerivedFrom() and isSameOrDerivedFrom(). |
Did you manually change this? This should be generated from the code, but I don't see this text anywhere in the code comments?