[PATCH] D33250: [Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong location
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 22 06:57:13 PDT 2017
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.
LGTM with one change below:
================
Comment at: lib/Sema/SemaDeclAttr.cpp:7256
+ bool VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *PRE) {
+ if (ObjCInterfaceDecl *ID = PRE->getClassReceiver())
+ DiagnoseDeclAvailability(ID, PRE->getReceiverLocation());
----------------
`getClassReceiver` calls `get` in a PointerUnion, which will trigger an assertion when the PRE is not a class receiver. Please rewrite this `if` to something like:
```
if (PRE->isClassReceiver())
DiagnoseDeclAvailability(PRE->getClassReceiver(), PRE->getReceiverLocation());
```
https://reviews.llvm.org/D33250
More information about the cfe-commits
mailing list