summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-05-08 07:28:25 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-05-08 07:28:25 +0000
commitd2e8fa14dfc0af88d6d9a4b073706ba87c10cb80 (patch)
tree2387aa00a93a22cc13fd4d131cddf5256f3925b1 /clang/lib/Analysis/RegionStore.cpp
parentdc04654697fbcb1d782700731069218d01b8bc75 (diff)
downloadbcm5719-llvm-d2e8fa14dfc0af88d6d9a4b073706ba87c10cb80.tar.gz
bcm5719-llvm-d2e8fa14dfc0af88d6d9a4b073706ba87c10cb80.zip
Region store: when casting VarRegions, if the cast-to pointee type is
incomplete, do not compute its size and return the original region. llvm-svn: 71213
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 32226af98f0..7f103dfab25 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -668,6 +668,14 @@ 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 the pointee type is incomplete, do not compute its size, and return
+ // the original region.
+ if (const RecordType *RT = dyn_cast<RecordType>(PointeeTy.getTypePtr())) {
+ const RecordDecl *D = RT->getDecl();
+ if (!D->getDefinition(getContext()))
+ return CastResult(state, R);
+ }
+
QualType ObjTy = cast<TypedRegion>(R)->getRValueType(getContext());
uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy);
uint64_t ObjTySize = getContext().getTypeSize(ObjTy);
OpenPOWER on IntegriCloud