[cfe-dev] Matcher working in clang-query, but not in LibTooling

Hartogs Siegfried via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 16 07:57:47 PST 2020


Hello everyone,

Why is it that the following matcher

cxxRecordDecl(has(unless(cxxRecordDecl())))

works in clang-query, but when copied to to a .cpp file, it won't compile the matcher:

../lib/UsingAnalysis.cpp:46:29: error: no matching function for call to object of type 'const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>'
    auto m = cxxRecordDecl(has(unless(cxxRecordDecl())));
                           ^~~
/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:1183:3: note: candidate template ignored: could not match 'Matcher' against 'VariadicOperatorMatcher'
  operator()(const Matcher<T> &InnerMatcher) const {

Tried on macOS 10.13 & Ubuntu 20.04 with LLVM 11.0.0.

Best,
Siegfried
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201116/203fd6d8/attachment.html>


More information about the cfe-dev mailing list