[cfe-commits] r139507 - in /cfe/trunk: lib/StaticAnalyzer/Core/SValBuilder.cpp test/Analysis/casts.m
Anna Zaks
ganna at apple.com
Mon Sep 12 10:56:08 PDT 2011
Author: zaks
Date: Mon Sep 12 12:56:08 2011
New Revision: 139507
URL: http://llvm.org/viewvc/llvm-project?rev=139507&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
cfe/trunk/test/Analysis/casts.m
Modified: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp?rev=139507&r1=139506&r2=139507&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp Mon Sep 12 12:56:08 2011
@@ -213,8 +213,13 @@
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))
Modified: cfe/trunk/test/Analysis/casts.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/casts.m?rev=139507&r1=139506&r2=139507&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/casts.m (original)
+++ cfe/trunk/test/Analysis/casts.m Mon Sep 12 12:56:08 2011
@@ -19,3 +19,23 @@
MyFuncTest1 fp = (MyFuncTest1) p;
return (*fp)();
}
+
+// <radar://10087620>
+// A cast from int onjective C property reference to int.
+typedef signed char BOOL;
+ at protocol NSObject - (BOOL)isEqual:(id)object; @end
+ at interface NSObject <NSObject> {} - (id)init; @end
+typedef enum {
+ AIMediaTypeAudio,
+ AIMediaTypeVideo
+} AIMediaType;
+ at interface AIMedia : NSObject {
+ AIMediaType mediaType;
+}
+ at property (readwrite, nonatomic) AIMediaType mediaType;
+static void
+adium_media_ready_cb(AIMedia *adiumMedia, const char *sid)
+{
+ adiumMedia.mediaType |= AIMediaTypeVideo;
+}
+ at end
\ No newline at end of file
More information about the cfe-commits
mailing list