[cfe-commits] r71213 - in /cfe/trunk: lib/Analysis/RegionStore.cpp test/Analysis/rdar-6541136-region.c
Zhongxing Xu
xuzhongxing at gmail.com
Fri May 8 00:28:25 PDT 2009
Author: zhongxingxu
Date: Fri May 8 02:28:25 2009
New Revision: 71213
URL: http://llvm.org/viewvc/llvm-project?rev=71213&view=rev
Log:
Region store: when casting VarRegions, if the cast-to pointee type is
incomplete, do not compute its size and return the original region.
Modified:
cfe/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/test/Analysis/rdar-6541136-region.c
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=71213&r1=71212&r2=71213&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Fri May 8 02:28:25 2009
@@ -668,6 +668,14 @@
// 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);
Modified: cfe/trunk/test/Analysis/rdar-6541136-region.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/rdar-6541136-region.c?rev=71213&r1=71212&r2=71213&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/rdar-6541136-region.c (original)
+++ cfe/trunk/test/Analysis/rdar-6541136-region.c Fri May 8 02:28:25 2009
@@ -1,5 +1,4 @@
// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s
-// XFAIL
struct tea_cheese { unsigned magic; };
typedef struct tea_cheese kernel_tea_cheese_t;
More information about the cfe-commits
mailing list