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");
}
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;
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());
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>");
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());
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);
}
// 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());
}
<< 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 ||
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)
// 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;
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(),
const AnalyzerOptions &Opts = SVB.getAnalyzerOptions();
if (Opts.ShouldConsiderSingleElementArraysAsFlexibleArrayMembers &&
- Size.isOneValue())
+ Size.isOne())
return true;
}
return false;
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();
// 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);
}
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: