@@ -1076,7 +1076,7 @@ static bool ProcessFormatStringLiteral(const Expr *FormatExpr,
1076
1076
void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
1077
1077
CallExpr *TheCall) {
1078
1078
if (TheCall->isValueDependent() || TheCall->isTypeDependent() ||
1079
- isConstantEvaluated ())
1079
+ isConstantEvaluatedContext ())
1080
1080
return;
1081
1081
1082
1082
bool UseDABAttr = false;
@@ -3192,7 +3192,7 @@ bool Sema::CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
3192
3192
3193
3193
bool Sema::CheckARMCoprocessorImmediate(const TargetInfo &TI,
3194
3194
const Expr *CoprocArg, bool WantCDE) {
3195
- if (isConstantEvaluated ())
3195
+ if (isConstantEvaluatedContext ())
3196
3196
return false;
3197
3197
3198
3198
// We can't check the value of a dependent argument.
@@ -6616,7 +6616,7 @@ static void CheckNonNullArguments(Sema &S,
6616
6616
assert((FDecl || Proto) && "Need a function declaration or prototype");
6617
6617
6618
6618
// Already checked by constant evaluator.
6619
- if (S.isConstantEvaluated ())
6619
+ if (S.isConstantEvaluatedContext ())
6620
6620
return;
6621
6621
// Check the attributes attached to the method/function itself.
6622
6622
llvm::SmallBitVector NonNullArgs;
@@ -8980,7 +8980,7 @@ bool Sema::SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
8980
8980
/// TheCall is a constant expression in the range [Low, High].
8981
8981
bool Sema::SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
8982
8982
int Low, int High, bool RangeIsError) {
8983
- if (isConstantEvaluated ())
8983
+ if (isConstantEvaluatedContext ())
8984
8984
return false;
8985
8985
llvm::APSInt Result;
8986
8986
@@ -9694,7 +9694,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
9694
9694
llvm::SmallBitVector &CheckedVarArgs,
9695
9695
UncoveredArgHandler &UncoveredArg, llvm::APSInt Offset,
9696
9696
bool IgnoreStringsWithoutSpecifiers = false) {
9697
- if (S.isConstantEvaluated ())
9697
+ if (S.isConstantEvaluatedContext ())
9698
9698
return SLCT_NotALiteral;
9699
9699
tryAgain:
9700
9700
assert(Offset.isSigned() && "invalid offset");
@@ -9734,8 +9734,8 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
9734
9734
bool CheckLeft = true, CheckRight = true;
9735
9735
9736
9736
bool Cond;
9737
- if (C->getCond()->EvaluateAsBooleanCondition(Cond, S.getASTContext(),
9738
- S.isConstantEvaluated ())) {
9737
+ if (C->getCond()->EvaluateAsBooleanCondition(
9738
+ Cond, S.getASTContext(), S.isConstantEvaluatedContext ())) {
9739
9739
if (Cond)
9740
9740
CheckRight = false;
9741
9741
else
@@ -9999,9 +9999,11 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
9999
9999
Expr::EvalResult LResult, RResult;
10000
10000
10001
10001
bool LIsInt = BinOp->getLHS()->EvaluateAsInt(
10002
- LResult, S.Context, Expr::SE_NoSideEffects, S.isConstantEvaluated());
10002
+ LResult, S.Context, Expr::SE_NoSideEffects,
10003
+ S.isConstantEvaluatedContext());
10003
10004
bool RIsInt = BinOp->getRHS()->EvaluateAsInt(
10004
- RResult, S.Context, Expr::SE_NoSideEffects, S.isConstantEvaluated());
10005
+ RResult, S.Context, Expr::SE_NoSideEffects,
10006
+ S.isConstantEvaluatedContext());
10005
10007
10006
10008
if (LIsInt != RIsInt) {
10007
10009
BinaryOperatorKind BinOpKind = BinOp->getOpcode();
@@ -10029,7 +10031,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
10029
10031
Expr::EvalResult IndexResult;
10030
10032
if (ASE->getRHS()->EvaluateAsInt(IndexResult, S.Context,
10031
10033
Expr::SE_NoSideEffects,
10032
- S.isConstantEvaluated ())) {
10034
+ S.isConstantEvaluatedContext ())) {
10033
10035
sumOffsets(Offset, IndexResult.Val.getInt(), BO_Add,
10034
10036
/*RHS is int*/ true);
10035
10037
E = ASE->getBase();
@@ -13959,7 +13961,7 @@ static bool CheckTautologicalComparison(Sema &S, BinaryOperator *E,
13959
13961
return false;
13960
13962
13961
13963
IntRange OtherValueRange = GetExprRange(
13962
- S.Context, Other, S.isConstantEvaluated (), /*Approximate*/ false);
13964
+ S.Context, Other, S.isConstantEvaluatedContext (), /*Approximate=*/ false);
13963
13965
13964
13966
QualType OtherT = Other->getType();
13965
13967
if (const auto *AT = OtherT->getAs<AtomicType>())
@@ -14174,8 +14176,9 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) {
14174
14176
}
14175
14177
14176
14178
// Otherwise, calculate the effective range of the signed operand.
14177
- IntRange signedRange = GetExprRange(
14178
- S.Context, signedOperand, S.isConstantEvaluated(), /*Approximate*/ true);
14179
+ IntRange signedRange =
14180
+ GetExprRange(S.Context, signedOperand, S.isConstantEvaluatedContext(),
14181
+ /*Approximate=*/true);
14179
14182
14180
14183
// Go ahead and analyze implicit conversions in the operands. Note
14181
14184
// that we skip the implicit conversions on both sides.
@@ -14193,8 +14196,8 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) {
14193
14196
if (E->isEqualityOp()) {
14194
14197
unsigned comparisonWidth = S.Context.getIntWidth(T);
14195
14198
IntRange unsignedRange =
14196
- GetExprRange(S.Context, unsignedOperand, S.isConstantEvaluated (),
14197
- /*Approximate*/ true);
14199
+ GetExprRange(S.Context, unsignedOperand, S.isConstantEvaluatedContext (),
14200
+ /*Approximate=*/ true);
14198
14201
14199
14202
// We should never be unable to prove that the unsigned operand is
14200
14203
// non-negative.
@@ -15057,7 +15060,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
15057
15060
if (Target->isUnsaturatedFixedPointType()) {
15058
15061
Expr::EvalResult Result;
15059
15062
if (E->EvaluateAsFixedPoint(Result, S.Context, Expr::SE_AllowSideEffects,
15060
- S.isConstantEvaluated ())) {
15063
+ S.isConstantEvaluatedContext ())) {
15061
15064
llvm::APFixedPoint Value = Result.Val.getFixedPoint();
15062
15065
llvm::APFixedPoint MaxVal = S.Context.getFixedPointMax(T);
15063
15066
llvm::APFixedPoint MinVal = S.Context.getFixedPointMin(T);
@@ -15072,7 +15075,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
15072
15075
}
15073
15076
} else if (Target->isIntegerType()) {
15074
15077
Expr::EvalResult Result;
15075
- if (!S.isConstantEvaluated () &&
15078
+ if (!S.isConstantEvaluatedContext () &&
15076
15079
E->EvaluateAsFixedPoint(Result, S.Context,
15077
15080
Expr::SE_AllowSideEffects)) {
15078
15081
llvm::APFixedPoint FXResult = Result.Val.getFixedPoint();
@@ -15095,7 +15098,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
15095
15098
} else if (Target->isUnsaturatedFixedPointType()) {
15096
15099
if (Source->isIntegerType()) {
15097
15100
Expr::EvalResult Result;
15098
- if (!S.isConstantEvaluated () &&
15101
+ if (!S.isConstantEvaluatedContext () &&
15099
15102
E->EvaluateAsInt(Result, S.Context, Expr::SE_AllowSideEffects)) {
15100
15103
llvm::APSInt Value = Result.Val.getInt();
15101
15104
@@ -15121,8 +15124,9 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
15121
15124
if (SourceBT && TargetBT && SourceBT->isIntegerType() &&
15122
15125
TargetBT->isFloatingType() && !IsListInit) {
15123
15126
// Determine the number of precision bits in the source integer type.
15124
- IntRange SourceRange = GetExprRange(S.Context, E, S.isConstantEvaluated(),
15125
- /*Approximate*/ true);
15127
+ IntRange SourceRange =
15128
+ GetExprRange(S.Context, E, S.isConstantEvaluatedContext(),
15129
+ /*Approximate=*/true);
15126
15130
unsigned int SourcePrecision = SourceRange.Width;
15127
15131
15128
15132
// Determine the number of precision bits in the
@@ -15190,16 +15194,16 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
15190
15194
15191
15195
IntRange SourceTypeRange =
15192
15196
IntRange::forTargetOfCanonicalType(S.Context, Source);
15193
- IntRange LikelySourceRange =
15194
- GetExprRange( S.Context, E, S.isConstantEvaluated (), /*Approximate*/ true);
15197
+ IntRange LikelySourceRange = GetExprRange(
15198
+ S.Context, E, S.isConstantEvaluatedContext (), /*Approximate=*/ true);
15195
15199
IntRange TargetRange = IntRange::forTargetOfCanonicalType(S.Context, Target);
15196
15200
15197
15201
if (LikelySourceRange.Width > TargetRange.Width) {
15198
15202
// If the source is a constant, use a default-on diagnostic.
15199
15203
// TODO: this should happen for bitfield stores, too.
15200
15204
Expr::EvalResult Result;
15201
15205
if (E->EvaluateAsInt(Result, S.Context, Expr::SE_AllowSideEffects,
15202
- S.isConstantEvaluated ())) {
15206
+ S.isConstantEvaluatedContext ())) {
15203
15207
llvm::APSInt Value(32);
15204
15208
Value = Result.Val.getInt();
15205
15209
@@ -16063,7 +16067,8 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> {
16063
16067
if (!EvalOK || E->isValueDependent())
16064
16068
return false;
16065
16069
EvalOK = E->EvaluateAsBooleanCondition(
16066
- Result, Self.SemaRef.Context, Self.SemaRef.isConstantEvaluated());
16070
+ Result, Self.SemaRef.Context,
16071
+ Self.SemaRef.isConstantEvaluatedContext());
16067
16072
return EvalOK;
16068
16073
}
16069
16074
@@ -17190,7 +17195,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
17190
17195
const ArraySubscriptExpr *ASE,
17191
17196
bool AllowOnePastEnd, bool IndexNegated) {
17192
17197
// Already diagnosed by the constant evaluator.
17193
- if (isConstantEvaluated ())
17198
+ if (isConstantEvaluatedContext ())
17194
17199
return;
17195
17200
17196
17201
IndexExpr = IndexExpr->IgnoreParenImpCasts();
@@ -18579,7 +18584,7 @@ void Sema::CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
18579
18584
TypeTagData TypeInfo;
18580
18585
if (!GetMatchingCType(ArgumentKind, TypeTagExpr, Context,
18581
18586
TypeTagForDatatypeMagicValues.get(), FoundWrongKind,
18582
- TypeInfo, isConstantEvaluated ())) {
18587
+ TypeInfo, isConstantEvaluatedContext ())) {
18583
18588
if (FoundWrongKind)
18584
18589
Diag(TypeTagExpr->getExprLoc(),
18585
18590
diag::warn_type_tag_for_datatype_wrong_kind)
0 commit comments