Skip to content

Commit 1036302

Browse files
committed
[Diagnostics] Add a getLoc method to FailureDiagnostic
1 parent 66e8572 commit 1036302

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Sema/CSDiagnostics.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class FailureDiagnostic {
5656

5757
virtual ~FailureDiagnostic();
5858

59+
virtual SourceLoc getLoc() const { return getAnchor()->getLoc(); }
60+
5961
/// Try to diagnose a problem given affected expression,
6062
/// failure location, types and declarations deduced by
6163
/// constraint system, and other auxiliary information.
@@ -832,7 +834,7 @@ class InvalidUseOfAddressOf final : public ContextualFailure {
832834

833835
protected:
834836
/// Compute location of the failure for diagnostic.
835-
SourceLoc getLoc() const;
837+
SourceLoc getLoc() const override;
836838
};
837839

838840
/// Diagnose mismatches relating to tuple destructuring.
@@ -1441,7 +1443,7 @@ class InvalidMemberRefInKeyPath : public FailureDiagnostic {
14411443

14421444
protected:
14431445
/// Compute location of the failure for diagnostic.
1444-
SourceLoc getLoc() const;
1446+
SourceLoc getLoc() const override;
14451447

14461448
bool isForKeyPathDynamicMemberLookup() const {
14471449
return getLocator()->isForKeyPathDynamicMemberLookup();
@@ -1819,8 +1821,6 @@ class ArgumentMismatchFailure : public ContextualFailure {
18191821
/// Are currently impossible to fix correctly,
18201822
/// so we have to attend to that in diagnostics.
18211823
bool diagnoseMisplacedMissingArgument() const;
1822-
1823-
SourceLoc getLoc() const { return getAnchor()->getLoc(); }
18241824
};
18251825

18261826
/// Replace a coercion ('as') with a forced checked cast ('as!').

0 commit comments

Comments
 (0)