[cfe-commits] r71360 - in /cfe/trunk: lib/Analysis/RegionStore.cpp test/Analysis/fields.c
Zhongxing Xu
xuzhongxing at gmail.com
Sat May 9 08:34:30 PDT 2009
Author: zhongxingxu
Date: Sat May 9 10:34:29 2009
New Revision: 71360
URL: http://llvm.org/viewvc/llvm-project?rev=71360&view=rev
Log:
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/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/test/Analysis/fields.c
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=71360&r1=71359&r2=71360&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Sat May 9 10:34:29 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/trunk/test/Analysis/fields.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/fields.c?rev=71360&r1=71359&r2=71360&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/fields.c (original)
+++ cfe/trunk/test/Analysis/fields.c Sat May 9 10:34:29 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 cfe-commits
mailing list