mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift-api-digester: add a flag to disable OS related diagnostics
For frameworks not shipping with OSs, the users should specify this flag to avoid diagnosing some changes, such as the missing of OS availability attributes.
This commit is contained in:
@@ -127,6 +127,12 @@ SwiftOnly("swift-only",
|
||||
llvm::cl::init(false),
|
||||
llvm::cl::cat(Category));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
DisableOSChecks("disable-os-checks",
|
||||
llvm::cl::desc("Skip OS related diagnostics"),
|
||||
llvm::cl::init(false),
|
||||
llvm::cl::cat(Category));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
PrintModule("print-module", llvm::cl::desc("Print module names in diagnostics"),
|
||||
llvm::cl::cat(Category));
|
||||
@@ -1006,7 +1012,8 @@ public:
|
||||
// Diagnose the missing of @available attributes.
|
||||
// Decls with @_alwaysEmitIntoClient aren't required to have an
|
||||
// @available attribute.
|
||||
if (!D->getIntroducingVersion().hasOSAvailability() &&
|
||||
if (!Ctx.getOpts().SkipOSCheck &&
|
||||
!D->getIntroducingVersion().hasOSAvailability() &&
|
||||
!D->hasDeclAttribute(DeclAttrKind::DAK_AlwaysEmitIntoClient)) {
|
||||
D->emitDiag(diag::new_decl_without_intro);
|
||||
}
|
||||
@@ -2377,6 +2384,7 @@ static CheckerOptions getCheckOpts() {
|
||||
Opts.LocationFilter = options::LocationFilter;
|
||||
Opts.PrintModule = options::PrintModule;
|
||||
Opts.SwiftOnly = options::SwiftOnly;
|
||||
Opts.SkipOSCheck = options::DisableOSChecks;
|
||||
return Opts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user