Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3514,6 +3514,20 @@ *Node.getArg(N)->IgnoreParenImpCasts(), Finder, Builder)); } +/// Matches the n'th item of an initializer list expression. +/// +/// Example matches y. +/// (matcher = initListExpr(hasInit(0, expr()))) +/// \code +/// int x{y}. +/// \endcode +AST_MATCHER_P2(InitListExpr, hasInit, unsigned, N, + ast_matchers::internal::Matcher, InnerMatcher) { + return N < Node.getNumInits() && + InnerMatcher.matches(*Node.getInit(N)->IgnoreParenImpCasts(), Finder, + Builder); +} + /// Matches declaration statements that contain a specific number of /// declarations. ///