Previously, we used TypeLocs to find the correct SourceLocations to emit -Wunguarded-availability. Unfortunately, TypeLocs can't be trusted as they sometimes have an an empty SourceLocation component. This new patch maintains the enclosing SourceLocation to be used instead.
Thanks for taking a look,
Erik
Details
Details
- Reviewers
arphaman - Commits
- rG6ac77a6c3728: [Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong…
rC303562: [Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong…
rL303562: [Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong…
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Just noticed this can be simplified a bit, NFC compared to the last version of the diff.
Comment Actions
Hmm, I don't like how we end with a location that points to x instead of InterWithProp. Can we ignore the TypeLocs with invalid location and instead look at ObjCPropertyRefExprs with a class receiver?
test/SemaObjC/unguarded-availability.m | ||
---|---|---|
141 ↗ | (On Diff #99235) | Should this be @property(class)? |
Comment Actions
Can we ignore the TypeLocs with invalid location and instead look at ObjCPropertyRefExprs with a class receiver?
Sure, good idea. This new patch does exactly that.
Thanks,
Erik
Comment Actions
LGTM with one change below:
lib/Sema/SemaDeclAttr.cpp | ||
---|---|---|
7256 ↗ | (On Diff #99605) | 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()); |