diff options
| author | Jay Foad <jay.foad@gmail.com> | 2010-12-07 08:25:34 +0000 |
|---|---|---|
| committer | Jay Foad <jay.foad@gmail.com> | 2010-12-07 08:25:34 +0000 |
| commit | 6d4db0c8850543661493af107a1d601d12a89509 (patch) | |
| tree | 8d09f8cde8e18587dc50e42150992071c57f9e43 /clang/lib/Checker | |
| parent | 583abbc4df3d9b9e5a86a56ae581970b98dc5249 (diff) | |
| download | bcm5719-llvm-6d4db0c8850543661493af107a1d601d12a89509.tar.gz bcm5719-llvm-6d4db0c8850543661493af107a1d601d12a89509.zip | |
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
llvm-svn: 121121
Diffstat (limited to 'clang/lib/Checker')
| -rw-r--r-- | clang/lib/Checker/SimpleConstraintManager.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Checker/SimpleSValBuilder.cpp | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Checker/SimpleConstraintManager.cpp b/clang/lib/Checker/SimpleConstraintManager.cpp index c23c749aa3e..9799aa8f960 100644 --- a/clang/lib/Checker/SimpleConstraintManager.cpp +++ b/clang/lib/Checker/SimpleConstraintManager.cpp @@ -265,11 +265,11 @@ const GRState *SimpleConstraintManager::assumeSymRel(const GRState *state, // Convert the adjustment. Adjustment.setIsUnsigned(isSymUnsigned); - Adjustment.extOrTrunc(bitwidth); + Adjustment = Adjustment.extOrTrunc(bitwidth); // Convert the right-hand side integer. llvm::APSInt ConvertedInt(Int, isSymUnsigned); - ConvertedInt.extOrTrunc(bitwidth); + ConvertedInt = ConvertedInt.extOrTrunc(bitwidth); switch (op) { default: diff --git a/clang/lib/Checker/SimpleSValBuilder.cpp b/clang/lib/Checker/SimpleSValBuilder.cpp index 49d55355ad3..6632c8eb1aa 100644 --- a/clang/lib/Checker/SimpleSValBuilder.cpp +++ b/clang/lib/Checker/SimpleSValBuilder.cpp @@ -97,7 +97,7 @@ SVal SimpleSValBuilder::evalCastNL(NonLoc val, QualType castTy) { llvm::APSInt i = cast<nonloc::ConcreteInt>(val).getValue(); i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::IsLocType(castTy)); - i.extOrTrunc(Context.getTypeSize(castTy)); + i = i.extOrTrunc(Context.getTypeSize(castTy)); if (isLocType) return makeIntLocVal(i); @@ -129,7 +129,7 @@ SVal SimpleSValBuilder::evalCastL(Loc val, QualType castTy) { llvm::APSInt i = cast<loc::ConcreteInt>(val).getValue(); i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::IsLocType(castTy)); - i.extOrTrunc(BitWidth); + i = i.extOrTrunc(BitWidth); return makeIntVal(i); } @@ -306,7 +306,7 @@ SVal SimpleSValBuilder::evalBinOpNN(const GRState *state, // Transform the integer into a location and compare. llvm::APSInt i = cast<nonloc::ConcreteInt>(rhs).getValue(); i.setIsUnsigned(true); - i.extOrTrunc(Context.getTypeSize(Context.VoidPtrTy)); + i = i.extOrTrunc(Context.getTypeSize(Context.VoidPtrTy)); return evalBinOpLL(state, op, lhsL, makeLoc(i), resultTy); } default: @@ -837,7 +837,7 @@ SVal SimpleSValBuilder::evalBinOpLN(const GRState *state, // Convert the bitwidth of rightI. This should deal with overflow // since we are dealing with concrete values. - rightI.extOrTrunc(leftI.getBitWidth()); + rightI = rightI.extOrTrunc(leftI.getBitWidth()); // Offset the increment by the pointer size. llvm::APSInt Multiplicand(rightI.getBitWidth(), /* isUnsigned */ true); |

