39 return Cast->getCastKind() == CK_UserDefinedConversion ||
40 Cast->getCastKind() == CK_FloatingToBoolean ||
41 Cast->getCastKind() == CK_FloatingToIntegral ||
42 Cast->getCastKind() == CK_IntegralToBoolean ||
43 Cast->getCastKind() == CK_IntegralToFloating ||
44 Cast->getCastKind() == CK_MemberPointerToBoolean ||
45 Cast->getCastKind() == CK_PointerToBoolean ||
46 (Cast->getCastKind() == CK_IntegralCast &&
47 Cast->getSubExpr()->getType()->isBooleanType());
84 const ASTContext &Ctx = *Result.Context;
85 const auto *Call = Result.Nodes.getNodeAs<CallExpr>(
"call");
87 llvm::SmallPtrSet<const Expr *, 4> UsedArgs;
88 for (
unsigned I = 1, E = Call->getNumArgs(); I < E; ++I) {
89 const Expr *LHS = Call->getArg(I - 1);
90 const Expr *RHS = Call->getArg(I);
94 if (UsedArgs.contains(RHS))
115 LHSFrom->getType(), RHSFrom->getType()))
119 diag(Call->getBeginLoc(),
"argument with implicit conversion from %0 "
120 "to %1 followed by argument converted from "
121 "%2 to %3, potentially swapped arguments.")
122 << LHSFrom->getType() << LHS->getType() << RHSFrom->getType()
123 << RHS->getType() << tooling::fixit::createReplacement(*LHS, *RHS, Ctx)
124 << tooling::fixit::createReplacement(*RHS, *LHS, Ctx);
127 UsedArgs.insert(RHSCast);