[cfe-commits] r114207 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenObjCXX/property-dot-copy.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Sep 17 13:45:45 PDT 2010
Author: fjahanian
Date: Fri Sep 17 15:45:45 2010
New Revision: 114207
URL: http://llvm.org/viewvc/llvm-project?rev=114207&view=rev
Log:
Only assignment operator triggers property setter call.
Fixes radar 8437253.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGenObjCXX/property-dot-copy.mm
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=114207&r1=114206&r2=114207&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Sep 17 15:45:45 2010
@@ -6720,7 +6720,7 @@
if (getLangOptions().CPlusPlus &&
((!isa<ObjCImplicitSetterGetterRefExpr>(lhs) &&
!isa<ObjCPropertyRefExpr>(lhs))
- || rhs->isTypeDependent()) &&
+ || rhs->isTypeDependent() || Opc != BO_Assign) &&
(lhs->getType()->isOverloadableType() ||
rhs->getType()->isOverloadableType())) {
// Find all of the overloaded operators visible from this
Modified: cfe/trunk/test/CodeGenObjCXX/property-dot-copy.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-dot-copy.mm?rev=114207&r1=114206&r2=114207&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-dot-copy.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/property-dot-copy.mm Fri Sep 17 15:45:45 2010
@@ -32,3 +32,37 @@
return 0;
}
+
+// rdar: // 8437253
+extern "C" void exit(...);
+
+struct CGPoint {
+ float x;
+ float y;
+};
+typedef struct CGPoint CGPoint;
+
+extern "C" const CGPoint CGPointZero;
+
+bool operator==(const CGPoint& a, const CGPoint& b);
+
+ at interface TIconViewSettings
+ at property (assign, nonatomic) CGPoint gridOffset;
+ at end
+
+ at implementation TIconViewSettings
+- (CGPoint) gridOffset
+{
+ return CGPointZero;
+}
+
+- (void) foo
+{
+ if ((self.gridOffset) == CGPointZero)
+ exit(1);
+
+ if (self.gridOffset == CGPointZero)
+ exit(1);
+}
+ at end
+
More information about the cfe-commits
mailing list