Index: cfe/trunk/docs/LibASTMatchersReference.html =================================================================== --- cfe/trunk/docs/LibASTMatchersReference.html +++ cfe/trunk/docs/LibASTMatchersReference.html @@ -1275,6 +1275,21 @@ +
Matches reference to a name that can be looked up during parsing +but could not be resolved to a specific declaration. + +Given + template<typename T> + T foo() { T a; return a; } + template<typename T> + void bar() { + foo<T>(); + } +unresolvedLookupExpr() + matches foo<T>()
Matches user defined literal operator call. Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h @@ -1086,6 +1086,24 @@ Decl, UsingDirectiveDecl> usingDirectiveDecl; +/// \brief Matches reference to a name that can be looked up during parsing +/// but could not be resolved to a specific declaration. +/// +/// Given +/// \code +/// template+/// T foo() { T a; return a; } +/// template +/// void bar() { +/// foo (); +/// } +/// \endcode +/// unresolvedLookupExpr() +/// matches \code foo () \endcode +const internal::VariadicDynCastAllOfMatcher< + Stmt, + UnresolvedLookupExpr> unresolvedLookupExpr; + /// \brief Matches unresolved using value declarations. /// /// Given Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp =================================================================== --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp @@ -399,6 +399,7 @@ REGISTER_MATCHER(unaryOperator); REGISTER_MATCHER(unaryTransformType); REGISTER_MATCHER(unless); + REGISTER_MATCHER(unresolvedLookupExpr); REGISTER_MATCHER(unresolvedUsingTypenameDecl); REGISTER_MATCHER(unresolvedUsingValueDecl); REGISTER_MATCHER(userDefinedLiteral); Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp =================================================================== --- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -177,6 +177,15 @@ EXPECT_TRUE(notMatches("enum X {};", Matcher)); } +TEST(Matcher, UnresolvedLookupExpr) { + EXPECT_TRUE(matches("template " + "T foo() { T a; return a; }" + "template " + "void bar() {" + " foo ();" + "}", + unresolvedLookupExpr())); +} TEST(Matcher, Call) { // FIXME: Do we want to overload Call() to directly take