From c2e3d5cb2980b06fd51b8f535561fe2ecd2c8a55 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 11 Dec 2012 18:53:07 +0000 Subject: [PATCH] Don't complain about incomplete implementations for methods that are unavailable due to availability attributes. llvm-svn: 169903 --- clang/lib/Sema/SemaDeclObjC.cpp | 11 ++++++++++- clang/test/SemaObjC/incomplete-implementation.m | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 14546de..64b000e 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1168,8 +1168,17 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, bool &IncompleteImpl, unsigned DiagID) { // No point warning no definition of method which is 'unavailable'. - if (method->hasAttr()) + switch (method->getAvailability()) { + case AR_Available: + case AR_Deprecated: + break; + + // Don't warn about unavailable or not-yet-introduced methods. + case AR_NotYetIntroduced: + case AR_Unavailable: return; + } + if (!IncompleteImpl) { Diag(ImpLoc, diag::warn_incomplete_impl); IncompleteImpl = true; diff --git a/clang/test/SemaObjC/incomplete-implementation.m b/clang/test/SemaObjC/incomplete-implementation.m index 54f66ef..69e355c 100644 --- a/clang/test/SemaObjC/incomplete-implementation.m +++ b/clang/test/SemaObjC/incomplete-implementation.m @@ -1,8 +1,10 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s @interface I - Meth; // expected-note{{method definition for 'Meth' not found}} \ // expected-note{{method 'Meth' declared here}} +- unavailableMeth __attribute__((availability(macosx,unavailable))); +- unavailableMeth2 __attribute__((unavailable)); @end @implementation I // expected-warning{{incomplete implementation}} -- 2.7.4