Author: fjahanian
Date: Tue Dec 9 16:43:22 2008
New Revision: 60803
URL: http://llvm.org/viewvc/llvm-project?rev=60803&view=rev
Log:
Prevent bogus warning on unimplemented setter/getter when user
has added declaration of these methods in its @interface.
Added:
cfe/trunk/test/SemaObjC/property-redundant-decl-accessor.m
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=60803&r1=60802&r2=60803&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Dec 9 16:43:22 2008
@@ -225,6 +225,7 @@
bool isVariadic() const { return IsVariadic; }
bool isSynthesized() const { return IsSynthesized; }
+ void setIsSynthesized() { IsSynthesized = true; }
// Related to protocols declared in @protocol
void setDeclImplementation(ImplementationControl ic) {
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=60803&r1=60802&r2=60803&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Dec 9 16:43:22 2008
@@ -456,6 +456,10 @@
insMethods.push_back(GetterDecl);
InsMap[property->getGetterName()] = GetterDecl;
}
+ else
+ // A user declared getter will be synthesize when @synthesize of
+ // the property with the same name is seen in the @implementation
+ GetterDecl->setIsSynthesized();
property->setGetterMethodDecl(GetterDecl);
// Skip setter if property is read-only.
@@ -487,6 +491,10 @@
0, 0);
SetterDecl->setMethodParams(&Argument, 1);
}
+ else
+ // A user declared setter will be synthesize when @synthesize of
+ // the property with the same name is seen in the @implementation
+ SetterDecl->setIsSynthesized();
property->setSetterMethodDecl(SetterDecl);
}
Added: cfe/trunk/test/SemaObjC/property-redundant-decl-accessor.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-redundant-decl-accessor.m?rev=60803&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-redundant-decl-accessor.m (added)
+++ cfe/trunk/test/SemaObjC/property-redundant-decl-accessor.m Tue Dec 9
16:43:22 2008
@@ -0,0 +1,18 @@
+// RUN: clang -fsyntax-only -Werror -verify %s
+
[EMAIL PROTECTED] MyClass {
+ const char *_myName;
+}
+
[EMAIL PROTECTED] const char *myName;
+
+- (const char *)myName;
+- (void)setMyName:(const char *)name;
+
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] MyClass
+
[EMAIL PROTECTED] myName = _myName;
+
[EMAIL PROTECTED]
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits