diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-05-08 02:12:59 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-05-08 02:12:59 +0000 |
commit | fb1e3310da7e3886c8057a5f009d2cdf30d8804f (patch) | |
tree | e485776a5ee743c0c02aaa5ebbe92ce18a1991c4 /lib/Analysis/RegionStore.cpp | |
parent | e6536afb1bc606a54abe0c357c8a2e1b8fc6e4e0 (diff) |
Replace the heuristic isSmallerThan with ASTContext::getTypeSize().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index ea42c465aa..32226af98f 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -616,13 +616,6 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) { return loc::MemRegionVal(ER); } -static bool isSmallerThan(QualType T1, QualType T2) { - if (T1->isCharType()) - return true; - else - return false; -} - RegionStoreManager::CastResult RegionStoreManager::CastRegion(const GRState* state, const MemRegion* R, QualType CastToTy) { @@ -675,8 +668,11 @@ RegionStoreManager::CastRegion(const GRState* state, const MemRegion* R, // VarRegion. if (isa<VarRegion>(R) || isa<ElementRegion>(R) || isa<FieldRegion>(R) || isa<ObjCIvarRegion>(R) || isa<CompoundLiteralRegion>(R)) { - if (isSmallerThan(PointeeTy, - cast<TypedRegion>(R)->getRValueType(getContext()))) { + QualType ObjTy = cast<TypedRegion>(R)->getRValueType(getContext()); + uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy); + uint64_t ObjTySize = getContext().getTypeSize(ObjTy); + + if (PointeeTySize > 0 && PointeeTySize < ObjTySize) { // Record the cast type of the region. state = setCastType(state, R, ToTy); |