martong added a comment.

> If you know the node is a decl, wrapping it in decl() should be enough.
>  Does this work?
>  auto WrappedMatcher = decl(anyOf(...));

Unfortunately this gives again the private ctor error (the same error when I 
called explicitly the overload with the `DeclarationMatcher`):

  
../../git/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1339:13:
 error: calling a private constructor of class 
'clang::ast_matchers::internal::Matcher<clang::Decl>'
      return {Matcher<T>(std::get<Is>(Params))...};
              ^
  
../../git/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1331:16:
 note: in instantiation of function template specialization 
'clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::Stmt>,
 
clang::ast_matchers::internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher,
 clang::ast_matchers::internal::TypeList<clang::Decl, clang::Stmt, 
clang::NestedNameSpecifier, clang::NestedNameSpecifierLoc, clang::QualType, 
clang::Type, clang::TypeLoc, clang::CXXCtorInitializer>, 
clang::ast_matchers::internal::TypeList<clang::Decl, clang::Stmt, 
clang::NestedNameSpecifier, clang::NestedNameSpecifierLoc, clang::TypeLoc, 
clang::QualType> >::Adaptor<clang::Stmt> >::getMatchers<clang::Decl, 0, 1>' 
requested here
                 getMatchers<T>(llvm::index_sequence_for<Ps...>()))
                 ^
  ../../git/llvm/tools/clang/unittests/AST/DeclMatcher.h:35:32: note: in 
instantiation of function template specialization 
'clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::Stmt>,
 
clang::ast_matchers::internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher,
 clang::ast_matchers::internal::TypeList<clang::Decl, clang::Stmt, 
clang::NestedNameSpecifier, clang::NestedNameSpecifierLoc, clang::QualType, 
clang::Type, clang::TypeLoc, clang::CXXCtorInitializer>, 
clang::ast_matchers::internal::TypeList<clang::Decl, clang::Stmt, 
clang::NestedNameSpecifier, clang::NestedNameSpecifierLoc, clang::TypeLoc, 
clang::QualType> >::Adaptor<clang::Stmt> >::operator Matcher<clang::Decl>' 
requested here
      auto WrappedMatcher = decl(anyOf(AMatcher.bind(""), 
hasDescendant(AMatcher.bind(""))));
                                 ^

Even if it would work then how could I support nodes other than decls (e.g. 
stmt())?


Repository:
  rC Clang

https://reviews.llvm.org/D49840



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to