Skip to content

Commit d80d76a

Browse files
committed
fixup cases where hasWrapsAttr should be used
Signed-off-by: Justin Stitt <[email protected]>
1 parent d92d896 commit d80d76a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ static bool CheckedIntArithmetic(EvalInfo &Info, const Expr *E,
27762776
Result = Value.trunc(LHS.getBitWidth());
27772777
if (Result.extend(BitWidth) != Value) {
27782778
if (Info.checkingForUndefinedBehavior() &&
2779-
!E->getType().getTypePtr()->hasAttr(attr::Wraps))
2779+
!E->getType().hasWrapsAttr())
27802780
Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
27812781
diag::warn_integer_constant_overflow)
27822782
<< toString(Result, 10, Result.isSigned(), /*formatAsCLiteral=*/false,
@@ -13995,7 +13995,7 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
1399513995
const APSInt &Value = Result.getInt();
1399613996
if (Value.isSigned() && Value.isMinSignedValue() && E->canOverflow()) {
1399713997
if (Info.checkingForUndefinedBehavior() &&
13998-
!E->getType().getTypePtr()->hasAttr(attr::Wraps))
13998+
!E->getType().hasWrapsAttr())
1399913999
Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
1400014000
diag::warn_integer_constant_overflow)
1400114001
<< toString(Value, 10, Value.isSigned(), /*formatAsCLiteral=*/false,

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value *Src, QualType SrcType,
11131113

11141114
// Do we care about this type of truncation?
11151115
if (!CGF.SanOpts.has(Check.second.second) ||
1116-
DstType.getTypePtr()->hasAttr(attr::Wraps))
1116+
DstType.hasWrapsAttr())
11171117
return;
11181118

11191119
llvm::Constant *StaticArgs[] = {

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16480,7 +16480,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
1648016480
IntRange TargetRange = IntRange::forTargetOfCanonicalType(S.Context, Target);
1648116481

1648216482
if (LikelySourceRange.Width > TargetRange.Width &&
16483-
!T.getTypePtr()->hasAttr(attr::Wraps)) {
16483+
!T.hasWrapsAttr()) {
1648416484
// If the source is a constant, use a default-on diagnostic.
1648516485
// TODO: this should happen for bitfield stores, too.
1648616486
Expr::EvalResult Result;
@@ -16528,7 +16528,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
1652816528

1652916529
if (TargetRange.Width == LikelySourceRange.Width &&
1653016530
!TargetRange.NonNegative && LikelySourceRange.NonNegative &&
16531-
Source->isSignedIntegerType() && !T.getTypePtr()->hasAttr(attr::Wraps)) {
16531+
Source->isSignedIntegerType() && !T.hasWrapsAttr()) {
1653216532
// Warn when doing a signed to signed conversion, warn if the positive
1653316533
// source value is exactly the width of the target type, which will
1653416534
// cause a negative value to be stored.

0 commit comments

Comments
 (0)