Hello, I need the findAll matcher to work with the dynamic/VariantMatcher interface for Reasons, but I’m running into problems writing the marshaller (I don’t fully understand the marshallers). I’ve gotten it to the point where clang-query no longer says it doesn’t recognize findAll, but it gives me this error now:
4:24: Error parsing matcher. Found token <(> while looking for ','.
I’m assuming I’m doing something wrong with getArgKinds() or getNumArgs() in the marshaller/MatcherDescriptor.
Here’s what I’ve added to Marshallers.h:
class FindAllBuilderDescriptor : public MatcherDescriptor {
public:
VariantMatcher create(SourceRange, ArrayRef<ParserValue>,
Diagnostics *) const override {
return {};
}
bool isBuilderMatcher() const override { return true; }
bool isVariadic() const override { return false; }
unsigned getNumArgs() const override { return 1; }
void getArgKinds(ASTNodeKind ThisKind, unsigned,
std::vector<ArgKind> &ArgKinds) const override {
ArgKinds.push_back(ArgKind::MakeMatcherArg(ThisKind));
}
bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity = nullptr,
ASTNodeKind *LeastDerivedKind = nullptr) const override {
if (Specificity)
*Specificity = 1;
if (LeastDerivedKind)
*LeastDerivedKind = Kind;
return true;
}
bool isPolymorphic() const override { return true; }
};
And here’s what I put in RegistryMaps::RegistryMaps() in Registry.cpp:
registerMatcher("findAll",
std::make_unique<internal::FindAllBuilderDescriptor>());