forked from OSchip/llvm-project
[APInt] Stop using soft-deprecated constructors and methods in clang. NFC.
Stop using APInt constructors and methods that were soft-deprecated in D109483. This fixes all the uses I found in clang. Differential Revision: https://reviews.llvm.org/D110808
This commit is contained in:
parent
a9bceb2b05
commit
d933adeaca
|
@ -165,7 +165,7 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
Expr::EvalResult ConstPtr;
|
||||
if (!Ptr->isInstantiationDependent() &&
|
||||
Ptr->EvaluateAsRValue(ConstPtr, Ctx) &&
|
||||
((ConstPtr.Val.isInt() && ConstPtr.Val.getInt().isNullValue()) ||
|
||||
((ConstPtr.Val.isInt() && ConstPtr.Val.getInt().isZero()) ||
|
||||
(ConstPtr.Val.isLValue() && ConstPtr.Val.isNullPointer()))) {
|
||||
diag(Loc, "constructing string from nullptr is undefined behaviour");
|
||||
}
|
||||
|
|
|
@ -2757,8 +2757,8 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS,
|
|||
Result = (Opcode == BO_Rem ? LHS % RHS : LHS / RHS);
|
||||
// Check for overflow case: INT_MIN / -1 or INT_MIN % -1. APSInt supports
|
||||
// this operation and gives the two's complement result.
|
||||
if (RHS.isNegative() && RHS.isAllOnesValue() &&
|
||||
LHS.isSigned() && LHS.isMinSignedValue())
|
||||
if (RHS.isNegative() && RHS.isAllOnes() && LHS.isSigned() &&
|
||||
LHS.isMinSignedValue())
|
||||
return HandleOverflow(Info, E, -LHS.extend(LHS.getBitWidth() + 1),
|
||||
E->getType());
|
||||
return true;
|
||||
|
@ -15324,7 +15324,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
|
|||
llvm::APSInt REval = Exp->getRHS()->EvaluateKnownConstInt(Ctx);
|
||||
if (REval == 0)
|
||||
return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc());
|
||||
if (REval.isSigned() && REval.isAllOnesValue()) {
|
||||
if (REval.isSigned() && REval.isAllOnes()) {
|
||||
llvm::APSInt LEval = Exp->getLHS()->EvaluateKnownConstInt(Ctx);
|
||||
if (LEval.isMinSignedValue())
|
||||
return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc());
|
||||
|
|
|
@ -2313,9 +2313,8 @@ void OMPTraitInfo::getAsVariantMatchInfo(ASTContext &ASTCtx,
|
|||
|
||||
if (Optional<APSInt> CondVal =
|
||||
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
|
||||
VMI.addTrait(CondVal->isNullValue()
|
||||
? TraitProperty::user_condition_false
|
||||
: TraitProperty::user_condition_true,
|
||||
VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
|
||||
: TraitProperty::user_condition_true,
|
||||
"<condition>");
|
||||
else
|
||||
VMI.addTrait(TraitProperty::user_condition_false, "<condition>");
|
||||
|
|
|
@ -1647,7 +1647,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
|||
for (unsigned i = 2; i < E->getNumSubExprs(); ++i) {
|
||||
llvm::APSInt Idx = E->getShuffleMaskIdx(CGF.getContext(), i-2);
|
||||
// Check for -1 and output it as undef in the IR.
|
||||
if (Idx.isSigned() && Idx.isAllOnesValue())
|
||||
if (Idx.isSigned() && Idx.isAllOnes())
|
||||
Indices.push_back(-1);
|
||||
else
|
||||
Indices.push_back(Idx.getZExtValue());
|
||||
|
|
|
@ -1357,7 +1357,7 @@ bool NumericLiteralParser::GetFixedPointValue(llvm::APInt &StoreVal, unsigned Sc
|
|||
Val *= Base;
|
||||
}
|
||||
} else if (BaseShift < 0) {
|
||||
for (int64_t i = BaseShift; i < 0 && !Val.isNullValue(); ++i)
|
||||
for (int64_t i = BaseShift; i < 0 && !Val.isZero(); ++i)
|
||||
Val = Val.udiv(Base);
|
||||
}
|
||||
|
||||
|
|
|
@ -1729,7 +1729,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
|
|||
// value so we bail out.
|
||||
if (SizeOp->isValueDependent())
|
||||
break;
|
||||
if (!SizeOp->EvaluateKnownConstInt(Context).isNullValue()) {
|
||||
if (!SizeOp->EvaluateKnownConstInt(Context).isZero()) {
|
||||
CheckNonNullArgument(*this, TheCall->getArg(0), TheCall->getExprLoc());
|
||||
CheckNonNullArgument(*this, TheCall->getArg(1), TheCall->getExprLoc());
|
||||
}
|
||||
|
@ -6776,7 +6776,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
|
|||
<< TheCall->getArg(i)->getSourceRange());
|
||||
|
||||
// Allow -1 which will be translated to undef in the IR.
|
||||
if (Result->isSigned() && Result->isAllOnesValue())
|
||||
if (Result->isSigned() && Result->isAllOnes())
|
||||
continue;
|
||||
|
||||
if (Result->getActiveBits() > 64 ||
|
||||
|
|
|
@ -3813,7 +3813,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
|
|||
|
||||
llvm::APInt Val(bit_width, 0, isSigned);
|
||||
bool Overflowed = Literal.GetFixedPointValue(Val, scale);
|
||||
bool ValIsZero = Val.isNullValue() && !Overflowed;
|
||||
bool ValIsZero = Val.isZero() && !Overflowed;
|
||||
|
||||
auto MaxVal = Context.getFixedPointMax(Ty).getValue();
|
||||
if (Literal.isFract && Val == MaxVal + 1 && !ValIsZero)
|
||||
|
@ -5254,7 +5254,7 @@ ExprResult Sema::ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc,
|
|||
// OpenMP 5.0, 2.1.6 Iterators, Restrictions
|
||||
// If the step expression of a range-specification equals zero, the
|
||||
// behavior is unspecified.
|
||||
if (Result && Result->isNullValue()) {
|
||||
if (Result && Result->isZero()) {
|
||||
Diag(Step->getExprLoc(), diag::err_omp_iterator_step_constant_zero)
|
||||
<< Step << Step->getSourceRange();
|
||||
IsCorrect = false;
|
||||
|
|
|
@ -18895,7 +18895,7 @@ public:
|
|||
Expr::EvalResult ResultL;
|
||||
if (!OASE->getLength()->isValueDependent() &&
|
||||
OASE->getLength()->EvaluateAsInt(ResultR, SemaRef.getASTContext()) &&
|
||||
!ResultR.Val.getInt().isOneValue()) {
|
||||
!ResultR.Val.getInt().isOne()) {
|
||||
SemaRef.Diag(OASE->getLength()->getExprLoc(),
|
||||
diag::err_omp_invalid_map_this_expr);
|
||||
SemaRef.Diag(OASE->getLength()->getExprLoc(),
|
||||
|
|
|
@ -794,7 +794,7 @@ DefinedOrUnknownSVal MemRegionManager::getStaticSize(const MemRegion *MR,
|
|||
|
||||
const AnalyzerOptions &Opts = SVB.getAnalyzerOptions();
|
||||
if (Opts.ShouldConsiderSingleElementArraysAsFlexibleArrayMembers &&
|
||||
Size.isOneValue())
|
||||
Size.isOne())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1568,7 +1568,7 @@ private:
|
|||
assert(!Constraint.isEmpty() && "Empty ranges shouldn't get here");
|
||||
|
||||
if (Constraint.getConcreteValue())
|
||||
return !Constraint.getConcreteValue()->isNullValue();
|
||||
return !Constraint.getConcreteValue()->isZero();
|
||||
|
||||
APSIntType T{Constraint.getMinValue()};
|
||||
Const Zero = T.getZeroValue();
|
||||
|
|
|
@ -128,14 +128,14 @@ SVal SimpleSValBuilder::MakeSymIntVal(const SymExpr *LHS,
|
|||
// a&0 and a&(~0)
|
||||
if (RHS == 0)
|
||||
return makeIntVal(0, resultTy);
|
||||
else if (RHS.isAllOnesValue())
|
||||
else if (RHS.isAllOnes())
|
||||
isIdempotent = true;
|
||||
break;
|
||||
case BO_Or:
|
||||
// a|0 and a|(~0)
|
||||
if (RHS == 0)
|
||||
isIdempotent = true;
|
||||
else if (RHS.isAllOnesValue()) {
|
||||
else if (RHS.isAllOnes()) {
|
||||
const llvm::APSInt &Result = BasicVals.Convert(resultTy, RHS);
|
||||
return nonloc::ConcreteInt(Result);
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ SVal SimpleSValBuilder::evalBinOpNN(ProgramStateRef state,
|
|||
continue;
|
||||
case BO_Shr:
|
||||
// (~0)>>a
|
||||
if (LHSValue.isAllOnesValue() && LHSValue.isSigned())
|
||||
if (LHSValue.isAllOnes() && LHSValue.isSigned())
|
||||
return evalCast(lhs, resultTy, QualType{});
|
||||
LLVM_FALLTHROUGH;
|
||||
case BO_Shl:
|
||||
|
|
Loading…
Reference in New Issue