From c076e37e2223cfe998fa5e657dece30da78fcdc4 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 6 Oct 2011 23:23:27 +0000 Subject: Implicitly assume that a ObjC category to an unavailable interface is also unavailable; only give an 'unavailable' error on the @implementation of the category. rdar://10234078 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141335 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Sema/SemaDecl.cpp') diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4a4862bec4..3692f447b3 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -9663,3 +9663,12 @@ void Sema::ActOnPragmaWeakAlias(IdentifierInfo* Name, Decl *Sema::getObjCDeclContext() const { return (dyn_cast_or_null(CurContext)); } + +AvailabilityResult Sema::getCurContextAvailability() const { + const Decl *D = cast(getCurLexicalContext()); + // A category implicitly has the availability of the interface. + if (const ObjCCategoryDecl *CatD = dyn_cast(D)) + D = CatD->getClassInterface(); + + return D->getAvailability(); +} -- cgit v1.2.3-70-g09d2