aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/CastSizeChecker.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-02 07:49:45 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-02 07:49:45 +0000
commitc8413fd03f73084a5c93028f8b4db619fc388087 (patch)
tree0815a7cb0b9c477e280a91e4c89713488e43f7f2 /lib/Checker/CastSizeChecker.cpp
parent0608f53744ccf88c4d21d6b500f6d23927533ac9 (diff)
Merge ValueManager into SValBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/CastSizeChecker.cpp')
-rw-r--r--lib/Checker/CastSizeChecker.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/Checker/CastSizeChecker.cpp b/lib/Checker/CastSizeChecker.cpp
index bb10f61475..29ad28b8ee 100644
--- a/lib/Checker/CastSizeChecker.cpp
+++ b/lib/Checker/CastSizeChecker.cpp
@@ -57,28 +57,27 @@ void CastSizeChecker::PreVisitCastExpr(CheckerContext &C, const CastExpr *CE) {
if (SR == 0)
return;
- ValueManager &ValMgr = C.getValueManager();
- SVal Extent = SR->getExtent(ValMgr);
-
- SValBuilder &svalBuilder = ValMgr.getSValBuilder();
- const llvm::APSInt *ExtentInt = svalBuilder.getKnownValue(state, Extent);
- if (!ExtentInt)
+ SValBuilder &svalBuilder = C.getSValBuilder();
+ SVal extent = SR->getExtent(svalBuilder);
+ const llvm::APSInt *extentInt = svalBuilder.getKnownValue(state, extent);
+ if (!extentInt)
return;
- CharUnits RegionSize = CharUnits::fromQuantity(ExtentInt->getSExtValue());
- CharUnits TypeSize = C.getASTContext().getTypeSizeInChars(ToPointeeTy);
-
+ CharUnits regionSize = CharUnits::fromQuantity(extentInt->getSExtValue());
+ CharUnits typeSize = C.getASTContext().getTypeSizeInChars(ToPointeeTy);
+
// Ignore void, and a few other un-sizeable types.
- if (TypeSize.isZero())
+ if (typeSize.isZero())
return;
-
- if (RegionSize % TypeSize != 0) {
- if (ExplodedNode *N = C.GenerateSink()) {
+
+ if (regionSize % typeSize != 0) {
+ if (ExplodedNode *errorNode = C.GenerateSink()) {
if (!BT)
BT = new BuiltinBug("Cast region with wrong size.",
"Cast a region whose size is not a multiple of the"
" destination type size.");
- RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(), N);
+ RangedBugReport *R = new RangedBugReport(*BT, BT->getDescription(),
+ errorNode);
R->addRange(CE->getSourceRange());
C.EmitReport(R);
}