@@ -521,8 +521,7 @@ static bool areEqualIntegers(const Expr *E1, const Expr *E2, ASTContext &Ctx) {
521521 Expr::EvalResult ER1, ER2;
522522
523523 // If both are constants:
524- if (E1 ->EvaluateAsInt (ER1, Ctx) &&
525- E2 ->EvaluateAsInt (ER2, Ctx))
524+ if (E1 ->EvaluateAsInt (ER1, Ctx) && E2 ->EvaluateAsInt (ER2, Ctx))
526525 return ER1.Val .getInt () == ER2.Val .getInt ();
527526
528527 // Otherwise, they should have identical stmt kind:
@@ -557,7 +556,7 @@ static bool areEqualIntegers(const Expr *E1, const Expr *E2, ASTContext &Ctx) {
557556// Sometimes, there is only one parameter index representing the total
558557// size.
559558static bool isSafeSpanTwoParamConstruct (const CXXConstructExpr &Node,
560- const ASTContext &Ctx) {
559+ ASTContext &Ctx) {
561560 assert (Node.getNumArgs () == 2 &&
562561 " expecting a two-parameter std::span constructor" );
563562 const Expr *Arg0 = Node.getArg (0 )->IgnoreParenImpCasts ();
@@ -698,10 +697,9 @@ static bool isSafeArraySubscript(const ArraySubscriptExpr &Node,
698697 const Expr *RHS = BE->getRHS ();
699698
700699 if ((!LHS->isValueDependent () &&
701- LHS->EvaluateAsInt (EVResult,
702- Finder->getASTContext ())) || // case: `n & e`
700+ LHS->EvaluateAsInt (EVResult, Ctx)) || // case: `n & e`
703701 (!RHS->isValueDependent () &&
704- RHS->EvaluateAsInt (EVResult, Finder-> getASTContext () ))) { // `e & n`
702+ RHS->EvaluateAsInt (EVResult, Ctx ))) { // `e & n`
705703 llvm::APSInt result = EVResult.Val .getInt ();
706704 if (result.isNonNegative () && result.getLimitedValue () < limit)
707705 return true ;
@@ -1510,8 +1508,7 @@ class SpanTwoParamConstructorGadget : public WarningGadget {
15101508 return G->getKind () == Kind::SpanTwoParamConstructor;
15111509 }
15121510
1513- static bool matches (const Stmt *S, const ASTContext &Ctx,
1514- MatchResult &Result) {
1511+ static bool matches (const Stmt *S, ASTContext &Ctx, MatchResult &Result) {
15151512 const auto *CE = dyn_cast<CXXConstructExpr>(S);
15161513 if (!CE)
15171514 return false ;
@@ -1526,7 +1523,7 @@ class SpanTwoParamConstructorGadget : public WarningGadget {
15261523 return true ;
15271524 }
15281525
1529- static bool matches (const Stmt *S, const ASTContext &Ctx,
1526+ static bool matches (const Stmt *S, ASTContext &Ctx,
15301527 const UnsafeBufferUsageHandler *Handler,
15311528 MatchResult &Result) {
15321529 if (ignoreUnsafeBufferInContainer (*S, Handler))
@@ -1800,8 +1797,7 @@ class UnsafeBufferUsageCtorAttrGadget : public WarningGadget {
18001797 return G->getKind () == Kind::UnsafeBufferUsageCtorAttr;
18011798 }
18021799
1803- static bool matches (const Stmt *S, const ASTContext &Ctx,
1804- MatchResult &Result) {
1800+ static bool matches (const Stmt *S, ASTContext &Ctx, MatchResult &Result) {
18051801 const auto *CE = dyn_cast<CXXConstructExpr>(S);
18061802 if (!CE || !CE->getConstructor ()->hasAttr <UnsafeBufferUsageAttr>())
18071803 return false ;
0 commit comments