Lines Matching full:cast
42 void checkPreStmt(const ImplicitCastExpr *Cast, CheckerContext &C) const;
47 bool isLossOfPrecision(const ImplicitCastExpr *Cast, QualType DestType,
50 bool isLossOfSign(const ImplicitCastExpr *Cast, CheckerContext &C) const;
57 void ConversionChecker::checkPreStmt(const ImplicitCastExpr *Cast, in checkPreStmt() argument
60 if (Cast->getType()->isBooleanType()) in checkPreStmt()
64 if (Cast->getExprLoc().isMacroID()) in checkPreStmt()
69 const Stmt *Parent = PM.getParent(Cast); in checkPreStmt()
72 // Dont warn if this is part of an explicit cast in checkPreStmt()
83 if (!Cast->IgnoreParenImpCasts()->isEvaluatable(C.getASTContext())) { in checkPreStmt()
84 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
85 LossOfPrecision = isLossOfPrecision(Cast, Cast->getType(), C); in checkPreStmt()
89 LossOfPrecision = isLossOfPrecision(Cast, B->getLHS()->getType(), C); in checkPreStmt()
91 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
92 LossOfPrecision = isLossOfPrecision(Cast, B->getLHS()->getType(), C); in checkPreStmt()
94 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
97 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
100 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
101 LossOfPrecision = isLossOfPrecision(Cast, B->getLHS()->getType(), C); in checkPreStmt()
103 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
106 if (!Cast->IgnoreParenImpCasts()->isEvaluatable(C.getASTContext())) { in checkPreStmt()
107 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
108 LossOfPrecision = isLossOfPrecision(Cast, Cast->getType(), C); in checkPreStmt()
111 LossOfSign = isLossOfSign(Cast, C); in checkPreStmt()
112 LossOfPrecision = isLossOfPrecision(Cast, Cast->getType(), C); in checkPreStmt()
121 reportBug(N, Cast, C, "Loss of sign in implicit conversion"); in checkPreStmt()
123 reportBug(N, Cast, C, "Loss of precision in implicit conversion"); in checkPreStmt()
135 bool ConversionChecker::isLossOfPrecision(const ImplicitCastExpr *Cast, in isLossOfPrecision() argument
139 if (Cast->isEvaluatable(C.getASTContext())) in isLossOfPrecision()
142 QualType SubType = Cast->IgnoreParenImpCasts()->getType(); in isLossOfPrecision()
187 return C.isGreaterOrEqual(Cast->getSubExpr(), MaxVal); in isLossOfPrecision()
191 bool ConversionChecker::isLossOfSign(const ImplicitCastExpr *Cast, in isLossOfSign() argument
193 QualType CastType = Cast->getType(); in isLossOfSign()
194 QualType SubType = Cast->IgnoreParenImpCasts()->getType(); in isLossOfSign()
199 return C.isNegative(Cast->getSubExpr()); in isLossOfSign()