mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Diagnostics] Replace diagnostics' 'DefaultIgnore' option with a corresponding option on diagnostic groups
This brings this control in line with other diagnostic controls we have which operate on a per-group level. 'DefaultIgnoreWarnings' diagnostic group option applies to all warnings belonging to a certain diagnostic group. The inheritance rules are: - Marking a diagnostic group as 'DefaultIgnoreWarnings' means warnings belonging to this group will not be emitted by-default - Warnings belonging to sub-groups of this group will also not be emitted by-default - Enabling a 'DefaultIgnoreWarnings' group (with '-Werror','-Wwarning', etc.) means warnings belonging to this group will be emitted. - Warnings belonging to sub-groups of this group will also be emitted. - Warnings belonging to super-groups of this group will not be affected.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "swift/AST/ASTWalker.h"
|
||||
#include "swift/AST/Decl.h"
|
||||
#include "swift/AST/DiagnosticsFrontend.h"
|
||||
#include "swift/AST/DiagnosticGroups.h"
|
||||
#include "swift/AST/DiagnosticsSema.h"
|
||||
#include "swift/AST/Evaluator.h"
|
||||
#include "swift/AST/Expr.h"
|
||||
@@ -30,22 +31,7 @@
|
||||
using namespace swift;
|
||||
|
||||
bool swift::performanceHintDiagnosticsEnabled(ASTContext &ctx) {
|
||||
return !ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_closure_returns_array.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_function_returns_array.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_param_expects_existential.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_func_returns_existential.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_closure_returns_existential.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_var_uses_existential.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_any_pattern_uses_existential.ID) ||
|
||||
!ctx.Diags.isIgnoredDiagnostic(
|
||||
diag::perf_hint_typealias_uses_existential.ID);
|
||||
return !ctx.Diags.isIgnoredDiagnosticGroupTree(DiagGroupID::PerformanceHints);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
Reference in New Issue
Block a user