================ @@ -420,6 +420,118 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { return false; } +class MaxValueEval : public RecursiveASTVisitor<MaxValueEval> { + + std::vector<llvm::APInt> val; + ASTContext &Context; + llvm::APInt Max; + unsigned bit_width; + +public: + typedef RecursiveASTVisitor<MaxValueEval> VisitorBase; + + explicit MaxValueEval(ASTContext &Ctx, const Expr *exp) : Context(Ctx) { + bit_width = Ctx.getIntWidth(exp->getType()); + Max = llvm::APInt::getSignedMaxValue(bit_width); ---------------- ziqingluo-90 wrote:
For the same `bit_width`, the unsigned max value will be different from the signed one, right? Maybe `Max` should depend on `exp`'s type. https://github.com/llvm/llvm-project/pull/112284 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits