[llvm-branch-commits] [cfe-branch] r71331 - in /cfe/branches/Apple/Dib: lib/Analysis/RegionStore.cpp test/Analysis/rdar-6541136-region.c

Mike Stump mrs at apple.com
Fri May 8 23:18:26 PDT 2009


Author: mrs
Date: Sat May  9 01:18:25 2009
New Revision: 71331

URL: http://llvm.org/viewvc/llvm-project?rev=71331&view=rev
Log:
Merge in 71213:

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/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
    cfe/branches/Apple/Dib/test/Analysis/rdar-6541136-region.c

Modified: cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp?rev=71331&r1=71330&r2=71331&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp Sat May  9 01:18: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/branches/Apple/Dib/test/Analysis/rdar-6541136-region.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/rdar-6541136-region.c?rev=71331&r1=71330&r2=71331&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/rdar-6541136-region.c (original)
+++ cfe/branches/Apple/Dib/test/Analysis/rdar-6541136-region.c Sat May  9 01:18: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 llvm-branch-commits mailing list