This is an archive of the discontinued LLVM Phabricator instance.

Warn about uses of `@available` that can't suppress the -Wunguarded-availability warnings
ClosedPublic

Authored by arphaman on May 23 2017, 10:34 AM.

Details

Summary

We should warn about uses of @available in all places except for if (@available(...)) because we only support the guarded availability checking using if (@available(...)).

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.May 23 2017, 10:34 AM
include/clang/Basic/DiagnosticSemaKinds.td
2889 ↗(On Diff #99948)

Might be a bit more clear if you mention in words that @available can only be the sole condition to the if? This is probably fine though.

lib/Sema/SemaExpr.cpp
15747 ↗(On Diff #99948)

I believe this will not be set if we're rebuilding a templated function, we should also flag this from TransformObjCAvailabilityCheckExpr in TreeTransform.h.

erik.pilkington accepted this revision.May 23 2017, 9:34 PM

LGTM, thanks!

lib/Sema/SemaExpr.cpp
15747 ↗(On Diff #99948)

On second thought, there is no point in doing that because we'd have already emitted a diagnostic from the pattern. This is correct as is.

This revision is now accepted and ready to land.May 23 2017, 9:34 PM
This revision was automatically updated to reflect the committed changes.