diff options
author | Anna Zaks <ganna@apple.com> | 2011-09-12 17:56:08 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-09-12 17:56:08 +0000 |
commit | f7afe4abd29062b1761e06ec22d2e4216c22519e (patch) | |
tree | 13f05f87f25c5293acf08ecd3116230c8af23062 | |
parent | 0047ed1f73b40b4b76ec190052a8deadb00734c2 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139507 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/StaticAnalyzer/Core/SValBuilder.cpp | 9 | ||||
-rw-r--r-- | test/Analysis/casts.m | 20 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp index e17f0bee20..ebf7ae2fd4 100644 --- a/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -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)) diff --git a/test/Analysis/casts.m b/test/Analysis/casts.m index b19ead4b05..c4edc044b8 100644 --- a/test/Analysis/casts.m +++ b/test/Analysis/casts.m @@ -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
\ No newline at end of file |