[PATCH] D34264: Introduce -Wunguarded-availability-new, which is like -Wunguarded-availability, except that it's enabled by default for new deployment targets
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 15 18:16:22 PDT 2017
erik.pilkington added inline comments.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:7315
+ default:
+ assert(!Triple.isMacOSX() && "MacOS should be handled in the switch");
+ // New targets should always warn about availability.
----------------
This assert seems a bit redundant, no?
================
Comment at: lib/Sema/SemaDeclAttr.cpp:7350
+ unsigned DiagKind =
+ !SemaRef.Diags.isIgnored(diag::warn_unguarded_availability_new,
+ Range.getBegin()) &&
----------------
There is a version of this for decls that aren't referenced in a function, such as:
```
typedef int __attribute__((availability(macos, introducced=1000))) new_int;
new_int x; // warn
// Also:
struct S {
new_int x; // warn
};
```
-Wunguarded-availability-new should also work with this, right? If we do want to support that, maybe we should add this check to ShouldDiagnoseAvailabilityOfDecl(), which is called by both paths.
Repository:
rL LLVM
https://reviews.llvm.org/D34264
More information about the cfe-commits
mailing list