DynTypedMatcher::constructVariadic() where the restrict kind of the
different matchers are not related causes the matcher to have a "None"
restrict kind. This causes false negatives for anyOf and eachOf.
Change the logic to get a common ancestor if there is one.
Also added regression tests that fail without the fix.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Overall, I think Anything and Nothing are not intuitive names for me here... Perhaps more docs will make it clear what they should be called.
include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
94–98 ↗ | (On Diff #14326) | a) why return anything()? (document the decisions, seems kinda arbitrary) |
105–106 ↗ | (On Diff #14326) | Can you document what Nothing and Anything is in NodeKind land, and document that? |
lib/AST/ASTTypeTraits.cpp | ||
23–32 ↗ | (On Diff #14326) | I just realize this all might need some documentation. |
unittests/ASTMatchers/Dynamic/RegistryTest.cpp | ||
350 ↗ | (On Diff #14326) | Is this test change related? |
Reverted a lot of the change.
Please review against the base.
include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
94–98 ↗ | (On Diff #14326) | Removed the concept of 'anything'. was not necessary and the name was not correct. |
105–106 ↗ | (On Diff #14326) | Reverted this. |
lib/AST/ASTTypeTraits.cpp | ||
23–32 ↗ | (On Diff #14326) | Reverted this. |
unittests/ASTMatchers/Dynamic/RegistryTest.cpp | ||
350 ↗ | (On Diff #14326) | Yes. The change triggered the bug. |