[cfe-commits] r44872 - in /cfe/trunk: Sema/SemaDecl.cpp test/Sema/enhanced-proto-2.m
Fariborz Jahanian
fjahanian at apple.com
Tue Dec 11 11:10:26 PST 2007
Author: fjahanian
Date: Tue Dec 11 13:10:26 2007
New Revision: 44872
URL: http://llvm.org/viewvc/llvm-project?rev=44872&view=rev
Log:
For @optional unimplemented methods do not issue the warning.
Added:
cfe/trunk/test/Sema/enhanced-proto-2.m
Modified:
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44872&r1=44871&r2=44872&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Dec 11 13:10:26 2007
@@ -1532,7 +1532,8 @@
// check unimplemented instance methods.
ObjcMethodDecl** methods = PDecl->getInstanceMethods();
for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) {
- if (!InsMap.count(methods[j]->getSelector())) {
+ if (!InsMap.count(methods[j]->getSelector()) &&
+ methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
methods[j]->getSelector().getName());
IncompleteImpl = true;
@@ -1541,7 +1542,8 @@
// check unimplemented class methods
methods = PDecl->getClassMethods();
for (int j = 0; j < PDecl->getNumClassMethods(); j++)
- if (!ClsMap.count(methods[j]->getSelector())) {
+ if (!ClsMap.count(methods[j]->getSelector()) &&
+ methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
methods[j]->getSelector().getName());
IncompleteImpl = true;
Added: cfe/trunk/test/Sema/enhanced-proto-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/enhanced-proto-2.m?rev=44872&view=auto
==============================================================================
--- cfe/trunk/test/Sema/enhanced-proto-2.m (added)
+++ cfe/trunk/test/Sema/enhanced-proto-2.m Tue Dec 11 13:10:26 2007
@@ -0,0 +1,21 @@
+// RUN: clang -verify %s
+
+ at protocol MyProto1
+ at optional
+- (void) FOO;
+ at optional
+- (void) FOO;
+ at optional
+- (void) REQ;
+ at optional
+ at end
+
+ at interface MyProto2 <MyProto1>
+- (void) FOO2;
+- (void) FOO3;
+ at end
+
+ at implementation MyProto2
+- (void) FOO2{}
+- (void) FOO3{}
+ at end
More information about the cfe-commits
mailing list