[llvm-branch-commits] [cfe-branch] r71382 - in /cfe/branches/Apple/Dib: lib/Analysis/RegionStore.cpp test/Analysis/fields.c

Mike Stump mrs at apple.com
Sat May 9 20:13:27 PDT 2009


Author: mrs
Date: Sat May  9 22:13:27 2009
New Revision: 71382

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

When casting VarRegion, if the var type is aggregate type and the cast-to
pointee type is scalar type, create element region regardless with the sizes
of types.

Modified:
    cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
    cfe/branches/Apple/Dib/test/Analysis/fields.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=71382&r1=71381&r2=71382&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp Sat May  9 22:13:27 2009
@@ -616,7 +616,8 @@
     uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy);
     uint64_t ObjTySize = getContext().getTypeSize(ObjTy);
 
-    if (PointeeTySize > 0 && PointeeTySize < ObjTySize) {
+    if ((PointeeTySize > 0 && PointeeTySize < ObjTySize) ||
+        (ObjTy->isAggregateType() && PointeeTy->isScalarType())) {
       // Record the cast type of the region.
       state = setCastType(state, R, ToTy);
 

Modified: cfe/branches/Apple/Dib/test/Analysis/fields.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/fields.c?rev=71382&r1=71381&r2=71382&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/fields.c (original)
+++ cfe/branches/Apple/Dib/test/Analysis/fields.c Sat May  9 22:13:27 2009
@@ -1,6 +1,5 @@
 // RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=basic -verify &&
 // RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=region -verify
-// XFAIL
 
 unsigned foo();
 typedef struct bf { unsigned x:2; } bf;





More information about the llvm-branch-commits mailing list