From 103630296d3ebcc41d7c48f0ab34b697efbfb51a Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Fri, 10 Apr 2020 13:03:41 -0700 Subject: [PATCH] [Diagnostics] Add a `getLoc` method to `FailureDiagnostic` --- lib/Sema/CSDiagnostics.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Sema/CSDiagnostics.h b/lib/Sema/CSDiagnostics.h index 6ca8227611e..0b98275f3ab 100644 --- a/lib/Sema/CSDiagnostics.h +++ b/lib/Sema/CSDiagnostics.h @@ -56,6 +56,8 @@ public: virtual ~FailureDiagnostic(); + virtual SourceLoc getLoc() const { return getAnchor()->getLoc(); } + /// Try to diagnose a problem given affected expression, /// failure location, types and declarations deduced by /// constraint system, and other auxiliary information. @@ -832,7 +834,7 @@ public: protected: /// Compute location of the failure for diagnostic. - SourceLoc getLoc() const; + SourceLoc getLoc() const override; }; /// Diagnose mismatches relating to tuple destructuring. @@ -1441,7 +1443,7 @@ public: protected: /// Compute location of the failure for diagnostic. - SourceLoc getLoc() const; + SourceLoc getLoc() const override; bool isForKeyPathDynamicMemberLookup() const { return getLocator()->isForKeyPathDynamicMemberLookup(); @@ -1819,8 +1821,6 @@ protected: /// Are currently impossible to fix correctly, /// so we have to attend to that in diagnostics. bool diagnoseMisplacedMissingArgument() const; - - SourceLoc getLoc() const { return getAnchor()->getLoc(); } }; /// Replace a coercion ('as') with a forced checked cast ('as!').