[PATCH] D33450: Warn about uses of `@available` that can't suppress the -Wunguarded-availability warnings
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 23 10:50:56 PDT 2017
erik.pilkington added inline comments.
================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2889
+ "use if (%select{@available|__builtin_available}0) instead">,
+ InGroup<DiagGroup<"unsupported-availability-guard">>;
----------------
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.
================
Comment at: lib/Sema/SemaExpr.cpp:15747
+ // warn when it's used inappropriately (i.e. not if(@available)).
+ if (getCurFunctionOrMethodDecl())
+ getEnclosingFunction()->HasPotentialAvailabilityViolations = true;
----------------
I believe this will not be set if we're rebuilding a templated function, we should also flag this from `TransformObjCAvailabilityCheckExpr` in TreeTransform.h.
Repository:
rL LLVM
https://reviews.llvm.org/D33450
More information about the cfe-commits
mailing list