From 9c64f211b66179d077c17d6808025fcfc39a61a8 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 5 Apr 2018 18:12:06 +0000 Subject: [PATCH] Remove the temporary availability checking workaround for the nested declarations in @interface. rdar://28825862 llvm-svn: 329324 --- clang/lib/Sema/SemaDeclAttr.cpp | 22 ---------------------- clang/test/SemaObjC/class-unavail-warning.m | 4 ++-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 1d2c3b5..709ba37 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -6828,28 +6828,6 @@ static bool ShouldDiagnoseAvailabilityInContext(Sema &S, AvailabilityResult K, return false; }; - // FIXME: This is a temporary workaround! Some existing Apple headers depends - // on nested declarations in an @interface having the availability of the - // interface when they really shouldn't: they are members of the enclosing - // context, and can referenced from there. - if (S.OriginalLexicalContext && cast(S.OriginalLexicalContext) != Ctx) { - const auto *OrigCtx = cast(S.OriginalLexicalContext); - if (CheckContext(OrigCtx)) - return false; - - // An implementation implicitly has the availability of the interface. - if (const auto *CatOrImpl = dyn_cast(OrigCtx)) { - if (const ObjCInterfaceDecl *Interface = CatOrImpl->getClassInterface()) - if (CheckContext(Interface)) - return false; - } - // A category implicitly has the availability of the interface. - else if (const auto *CatD = dyn_cast(OrigCtx)) - if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface()) - if (CheckContext(Interface)) - return false; - } - do { if (CheckContext(Ctx)) return false; diff --git a/clang/test/SemaObjC/class-unavail-warning.m b/clang/test/SemaObjC/class-unavail-warning.m index f7d8f56..30ebf79 100644 --- a/clang/test/SemaObjC/class-unavail-warning.m +++ b/clang/test/SemaObjC/class-unavail-warning.m @@ -115,9 +115,9 @@ UNAVAILABLE __attribute__((objc_root_class)) } @end -typedef int unavailable_int UNAVAILABLE; +typedef int unavailable_int UNAVAILABLE; // expected-note {{'unavailable_int' has been explicitly marked unavailable here}} UNAVAILABLE @interface A -extern unavailable_int global_unavailable; // FIXME: this should be an error! +extern unavailable_int global_unavailable; // expected-error {{'unavailable_int' is unavailable: not available}} @end -- 2.7.4