r329324 - Remove the temporary availability checking workaround for

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 5 11:12:06 PDT 2018


Author: arphaman
Date: Thu Apr  5 11:12:06 2018
New Revision: 329324

URL: http://llvm.org/viewvc/llvm-project?rev=329324&view=rev
Log:
Remove the temporary availability checking workaround for
the nested declarations in @interface.

rdar://28825862

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/SemaObjC/class-unavail-warning.m

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=329324&r1=329323&r2=329324&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Apr  5 11:12:06 2018
@@ -6828,28 +6828,6 @@ static bool ShouldDiagnoseAvailabilityIn
     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<Decl>(S.OriginalLexicalContext) != Ctx) {
-    const auto *OrigCtx = cast<Decl>(S.OriginalLexicalContext);
-    if (CheckContext(OrigCtx))
-      return false;
-
-    // An implementation implicitly has the availability of the interface.
-    if (const auto *CatOrImpl = dyn_cast<ObjCImplDecl>(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<ObjCCategoryDecl>(OrigCtx))
-      if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface())
-        if (CheckContext(Interface))
-          return false;
-  }
-
   do {
     if (CheckContext(Ctx))
       return false;

Modified: cfe/trunk/test/SemaObjC/class-unavail-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/class-unavail-warning.m?rev=329324&r1=329323&r2=329324&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/class-unavail-warning.m (original)
+++ cfe/trunk/test/SemaObjC/class-unavail-warning.m Thu Apr  5 11:12:06 2018
@@ -115,9 +115,9 @@ UNAVAILABLE __attribute__((objc_root_cla
 }
 @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




More information about the cfe-commits mailing list