[analyzer] Fix a new failure encountered while building Adium exposed as a result of r138196(radar://10087620). ObjectiveC property of type int has a value of type ObjCPropRef, which is a Loc.

llvm-svn: 139507
This commit is contained in:
Anna Zaks 2011-09-12 17:56:08 +00:00
parent 964c186ffe
commit 295208d744
2 changed files with 27 additions and 2 deletions

View File

@ -213,8 +213,13 @@ SVal SValBuilder::evalCast(SVal val, QualType castTy, QualType originalTy) {
return UnknownVal();
// Check for casts from integers to integers.
if (castTy->isIntegerType() && originalTy->isIntegerType())
return evalCastFromNonLoc(cast<NonLoc>(val), castTy);
if (castTy->isIntegerType() && originalTy->isIntegerType()) {
if (isa<Loc>(val))
// This can be a cast to ObjC property of type int.
return evalCastFromLoc(cast<Loc>(val), castTy);
else
return evalCastFromNonLoc(cast<NonLoc>(val), castTy);
}
// Check for casts from pointers to integers.
if (castTy->isIntegerType() && Loc::isLocType(originalTy))

View File

@ -19,3 +19,23 @@ void* test2(void *p) {
MyFuncTest1 fp = (MyFuncTest1) p;
return (*fp)();
}
// <radar://10087620>
// A cast from int onjective C property reference to int.
typedef signed char BOOL;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
@interface NSObject <NSObject> {} - (id)init; @end
typedef enum {
AIMediaTypeAudio,
AIMediaTypeVideo
} AIMediaType;
@interface AIMedia : NSObject {
AIMediaType mediaType;
}
@property (readwrite, nonatomic) AIMediaType mediaType;
static void
adium_media_ready_cb(AIMedia *adiumMedia, const char *sid)
{
adiumMedia.mediaType |= AIMediaTypeVideo;
}
@end