================ @@ -164,26 +164,32 @@ TEST_P(ASTMatchersTest, AllOf) { "void g(int x) { struct T t; f(x, &t, 3, 4); }"; EXPECT_TRUE(matches( Program, callExpr(allOf(callee(functionDecl(hasName("f"))), - hasArgument(0, declRefExpr(to(varDecl()))))))); + hasArgument(0, ignoringParenImpCasts(declRefExpr( + to(varDecl())))))))); EXPECT_TRUE(matches( Program, - callExpr( - allOf(callee(functionDecl(hasName("f"))), - hasArgument(0, declRefExpr(to(varDecl()))), - hasArgument(1, hasType(pointsTo(recordDecl(hasName("T"))))))))); + callExpr(allOf( + callee(functionDecl(hasName("f"))), + hasArgument(0, ignoringParenImpCasts(declRefExpr(to(varDecl())))), + hasArgument(1, ignoringParenImpCasts( + hasType(pointsTo(recordDecl(hasName("T")))))))))); EXPECT_TRUE(matches( - Program, callExpr(allOf( - callee(functionDecl(hasName("f"))), - hasArgument(0, declRefExpr(to(varDecl()))), - hasArgument(1, hasType(pointsTo(recordDecl(hasName("T"))))), - hasArgument(2, integerLiteral(equals(3))))))); + Program, + callExpr(allOf( + callee(functionDecl(hasName("f"))), + hasArgument(0, ignoringParenImpCasts(declRefExpr(to(varDecl())))), + hasArgument(1, ignoringParenImpCasts( + hasType(pointsTo(recordDecl(hasName("T")))))), + hasArgument(2, ignoringParenImpCasts(integerLiteral(equals(3)))))))); EXPECT_TRUE(matches( - Program, callExpr(allOf( - callee(functionDecl(hasName("f"))), - hasArgument(0, declRefExpr(to(varDecl()))), - hasArgument(1, hasType(pointsTo(recordDecl(hasName("T"))))), - hasArgument(2, integerLiteral(equals(3))), - hasArgument(3, integerLiteral(equals(4))))))); + Program, + callExpr(allOf( + callee(functionDecl(hasName("f"))), + hasArgument(0, ignoringParenImpCasts(declRefExpr(to(varDecl())))), + hasArgument(1, ignoringParenImpCasts( + hasType(pointsTo(recordDecl(hasName("T")))))), + hasArgument(2, ignoringParenImpCasts(integerLiteral(equals(3)))), + hasArgument(3, ignoringParenImpCasts(integerLiteral(equals(4)))))))); ---------------- 5chmidti wrote:
Please remove the `ignoringParenImpCasts` from all `hasArgument(1, ` matchers. These only care about the type, for which implicit nodes do not play a role for these matchers (fwict). https://github.com/llvm/llvm-project/pull/89553 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits