Author: fjahanian
Date: Fri Oct 15 17:42:59 2010
New Revision: 116631
URL: http://llvm.org/viewvc/llvm-project?rev=116631&view=rev
Log:
Check for ivar being a C++ object before attempting to
find a copy constructor/assignment operator used
in getter/setter synthesis. This removes an unintended
diagnostics and makes objc++ consistant with objective-c.
// rdar: //8550657.
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=116631&r1=116630&r2=116631&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Oct 15 17:42:59 2010
@@ -460,7 +460,8 @@
Ivar);
if (ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) {
getterMethod->createImplicitParams(Context, IDecl);
- if (getLangOptions().CPlusPlus && Synthesize) {
+ if (getLangOptions().CPlusPlus && Synthesize &&
+ Ivar->getType()->isRecordType()) {
// For Objective-C++, need to synthesize the AST for the IVAR object to
be
// returned by the getter as it must conform to C++'s copy-return rules.
// FIXME. Eventually we want to do this for Objective-C as well.
@@ -488,7 +489,8 @@
}
if (ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) {
setterMethod->createImplicitParams(Context, IDecl);
- if (getLangOptions().CPlusPlus && Synthesize) {
+ if (getLangOptions().CPlusPlus && Synthesize
+ && Ivar->getType()->isRecordType()) {
// FIXME. Eventually we want to do this for Objective-C as well.
ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl();
DeclRefExpr *SelfExpr =
Modified: cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm?rev=116631&r1=116630&r2=116631&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm Fri Oct 15 17:42:59
2010
@@ -22,7 +22,7 @@
@implementation MyClass
-...@synthesize array=_array; // expected-error {{assigning to 'NSMutableArray
*' from incompatible type 'NSArray *'}}
+...@synthesize array=_array;
@end
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits