Author: aaronballman Date: Fri Mar 2 11:14:21 2018 New Revision: 326604 URL: http://llvm.org/viewvc/llvm-project?rev=326604&view=rev Log: Fix the hasType() AST matcher to not assert when the QualType is invalid.
There's not a particularly good way to test this with the AST matchers unit tests because the only way to get an invalid type (that I can devise) involves creating parse errors, which the test harness always treats as a failure. Instead, a clang-tidy test case will be added in a follow-up commit based on the original bug report. Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=326604&r1=326603&r2=326604&view=diff ============================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original) +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Mar 2 11:14:21 2018 @@ -2843,8 +2843,10 @@ AST_MATCHER_P_OVERLOAD(CallExpr, callee, AST_POLYMORPHIC_MATCHER_P_OVERLOAD( hasType, AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, TypedefNameDecl, ValueDecl), internal::Matcher<QualType>, InnerMatcher, 0) { - return InnerMatcher.matches(internal::getUnderlyingType(Node), - Finder, Builder); + QualType QT = internal::getUnderlyingType(Node); + if (!QT.isNull()) + return InnerMatcher.matches(QT, Finder, Builder); + return false; } /// \brief Overloaded to match the declaration of the expression's or value _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits