SilensAngelusNex added a comment. Here's my branch on Github: https://github.com/SilensAngelusNex/llvm-project/tree/has-type-info
================ Comment at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:138-150 +template <typename... T> struct disjunction; +template <typename T> struct disjunction<T> : public T {}; +template <typename Head, typename... Tail> struct disjunction<Head, Tail...> { + using type = + typename std::conditional<Head::value, Head, disjunction<Tail...>>::type; + static constexpr bool value = type::value; +}; ---------------- steveire wrote: > SilensAngelusNex wrote: > > Is there a better way to express this? I was originally using > > > > ``` > > template <typename... Expected> struct is_one_of { > > template <typename T> > > static constexpr bool value = (std::is_base_of_v<Expected, T> || ...); > > }; > > ``` > > but that didn't compile because `is_base_of_v` and fold expressions are > > C++17 features. > > > > Maybe it would be better to just explicitly write out an overload of > > `GetTypeSourceInfo` for each type? > > I like your c++17 solution too, but given that we have > `TypeListContainsSuperOf` in this file used for this kind of thing, I think > it makes sense to use that. I think this will work: > > ``` > template <typename T, > std::enable_if_t<ast_matchers::internal::TypeListContainsSuperOf< > ast_matchers::internal::TypeList< > CXXBaseSpecifier, CXXCtorInitializer, CXXTemporaryObjectExpr, > CXXUnresolvedConstructExpr, CompoundLiteralExpr, DeclaratorDecl, > ObjCPropertyDecl, TemplateArgumentLoc, TypedefNameDecl>, > T>::value> > * = nullptr> > ``` > Perfect, thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101572/new/ https://reviews.llvm.org/D101572 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits