[PATCH] D33816: [Sema][ObjC] Don't allow -Wunguarded-availability to be silenced with redeclarations

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 13:53:06 PDT 2017


arphaman added a comment.

I find the change to the diagnostic for enum constants a bit off putting, since the warning can refer to the enum itself when an enum constant is used. I'd rather we say something like `'EnumConstant' is deprecated` and keep the note that this patch uses (`'Enum' has been explicitly marked deprecated here`).



================
Comment at: lib/Sema/SemaDeclAttr.cpp:7077
   if (K == AR_NotYetIntroduced)
-    S.Diag(Loc, diag::note_partial_availability_silence) << D;
+    if (NamedDecl *Enclosing = findEnclosingDeclToAnnotate(Ctx))
+      S.Diag(Enclosing->getLocStart(), diag::note_partial_availability_silence)
----------------
You can use `const auto *` here.


================
Comment at: lib/Sema/SemaExpr.cpp:115
 
-  if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(D))
+  if (EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(D))
     if (Result == AR_Available) {
----------------
You can use `auto *` here.


================
Comment at: lib/Sema/SemaExpr.cpp:118
+      DeclContext *DC = ECD->getDeclContext();
+      if (EnumDecl *TheEnumDecl = dyn_cast<EnumDecl>(DC)) {
         Result = TheEnumDecl->getAvailability(Message);
----------------
You can use `auto *` here as well.


https://reviews.llvm.org/D33816





More information about the cfe-commits mailing list