diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-06 21:01:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-06 21:01:16 +0000 |
commit | 145918ca119904b6abe8b41aae0cbbf9a7247905 (patch) | |
tree | 884382dd798f299553147aeeab058616e56bc855 /lib/Analysis/Store.cpp | |
parent | ca4e1b765abd796b07dc6a78a9cb1711f467a8cc (diff) |
NewCastRegion:
- Have test for 'CodeTextRegion' dominate other region tests.
- Use 'getAsRecordType' instead of isa<RecordType>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Store.cpp')
-rw-r--r-- | lib/Analysis/Store.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp index 4f0e4a62e9..cd123995fa 100644 --- a/lib/Analysis/Store.cpp +++ b/lib/Analysis/Store.cpp @@ -30,13 +30,7 @@ StoreManager::NewCastRegion(const GRState *state, const MemRegion* R, // We need to know the real type of CastToTy. QualType ToTy = Ctx.getCanonicalType(CastToTy); - - // Check cast to ObjCQualifiedID type. - if (ToTy->isObjCQualifiedIdType()) { - // FIXME: Record the type information aside. - return CastResult(state, R); - } - + // CodeTextRegion should be cast to only function pointer type. if (isa<CodeTextRegion>(R)) { assert(CastToTy->isFunctionPointerType() || CastToTy->isBlockPointerType() @@ -45,6 +39,12 @@ StoreManager::NewCastRegion(const GRState *state, const MemRegion* R, return CastResult(state, R); } + // Check cast to ObjCQualifiedID type. + if (ToTy->isObjCQualifiedIdType()) { + // FIXME: Record the type information aside. + return CastResult(state, R); + } + // Now assume we are casting from pointer to pointer. Other cases should // already be handled. QualType PointeeTy = cast<PointerType>(ToTy.getTypePtr())->getPointeeType(); @@ -65,7 +65,7 @@ StoreManager::NewCastRegion(const GRState *state, const MemRegion* R, || isa<ObjCIvarRegion>(R) || isa<CompoundLiteralRegion>(R)) { // If the pointee type is incomplete, do not compute its size, and return // the original region. - if (const RecordType *RT = dyn_cast<RecordType>(PointeeTy.getTypePtr())) { + if (const RecordType *RT = PointeeTy->getAsRecordType()) { const RecordDecl *D = RT->getDecl(); if (!D->getDefinition(Ctx)) return CastResult(state, R); @@ -121,7 +121,6 @@ StoreManager::OldCastRegion(const GRState* state, const MemRegion* R, // FIXME: Handle arbitrary upcasts. QualType Pointee = PTy->getPointeeType(); if (Pointee->isVoidType()) { - while (true) { if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) { // Casts to void* removes TypedViewRegion. This happens when: @@ -149,8 +148,8 @@ StoreManager::OldCastRegion(const GRState* state, const MemRegion* R, R = ER->getSuperRegion(); continue; } - else - break; + + break; } return CastResult(state, R); @@ -178,7 +177,6 @@ StoreManager::OldCastRegion(const GRState* state, const MemRegion* R, // FIXME: Handle the case where a TypedViewRegion (layering a SymbolicRegion // or an AllocaRegion is cast to another view, thus causing the memory // to be re-used for a different purpose. - if (isa<SymbolicRegion>(R) || isa<AllocaRegion>(R)) { const MemRegion* ViewR = MRMgr.getTypedViewRegion(CastToTy, R); return CastResult(AddRegionView(state, ViewR, R), ViewR); |