summaryrefslogtreecommitdiffstats
path: root/include/clang/ASTMatchers/ASTMatchers.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/ASTMatchers/ASTMatchers.h')
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 7a52ec50db..f42ac5b701 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -811,11 +811,28 @@ AST_MATCHER_P(Expr, ignoringParenImpCasts,
/// varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
/// \endcode
/// would match the declaration for fp.
-AST_MATCHER_P(QualType, ignoringParens,
- internal::Matcher<QualType>, InnerMatcher) {
+AST_MATCHER_P_OVERLOAD(QualType, ignoringParens, internal::Matcher<QualType>,
+ InnerMatcher, 0) {
return InnerMatcher.matches(Node.IgnoreParens(), Finder, Builder);
}
+/// Overload \c ignoringParens for \c Expr.
+///
+/// Given
+/// \code
+/// const char* str = ("my-string");
+/// \endcode
+/// The matcher
+/// \code
+/// implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
+/// \endcode
+/// would match the implicit cast resulting from the assignment.
+AST_MATCHER_P_OVERLOAD(Expr, ignoringParens, internal::Matcher<Expr>,
+ InnerMatcher, 1) {
+ const Expr *E = Node.IgnoreParens();
+ return InnerMatcher.matches(*E, Finder, Builder);
+}
+
/// Matches expressions that are instantiation-dependent even if it is
/// neither type- nor value-dependent.
///