mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Constify DiagnosticState::determineBehavior
Split out the state mutation into a new `updateFor` function that we call for diagnostic emission, allowing `DiagnosticTransaction::hasErrors` to query the behavior without mutating any state.
This commit is contained in:
@@ -618,7 +618,10 @@ namespace swift {
|
||||
|
||||
/// Figure out the Behavior for the given diagnostic, taking current
|
||||
/// state such as fatality into account.
|
||||
DiagnosticBehavior determineBehavior(const Diagnostic &diag);
|
||||
DiagnosticBehavior determineBehavior(const Diagnostic &diag) const;
|
||||
|
||||
/// Updates the diagnostic state for a diagnostic to emit.
|
||||
void updateFor(DiagnosticBehavior behavior);
|
||||
|
||||
bool hadAnyError() const { return anyErrorOccurred; }
|
||||
bool hasFatalErrorOccurred() const { return fatalErrorOccurred; }
|
||||
@@ -646,7 +649,7 @@ namespace swift {
|
||||
|
||||
/// Returns a Boolean value indicating whether warnings belonging to the
|
||||
/// diagnostic group identified by `id` should be escalated to errors.
|
||||
bool getWarningsAsErrorsForDiagGroupID(DiagGroupID id) {
|
||||
bool getWarningsAsErrorsForDiagGroupID(DiagGroupID id) const {
|
||||
return warningsAsErrors[(unsigned)id];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user