@@ -729,28 +729,28 @@ class Parser {
729
729
}
730
730
731
731
public:
732
- InFlightDiagnostic diagnose (SourceLoc Loc, Diagnostic Diag) {
732
+ InFlightDiagnostic diagnose (SourceLoc Loc, DiagRef Diag) {
733
733
if (Diags.isDiagnosticPointsToFirstBadToken (Diag.getID ()) &&
734
734
Loc == Tok.getLoc () && Tok.isAtStartOfLine ())
735
735
Loc = getEndOfPreviousLoc ();
736
736
return Diags.diagnose (Loc, Diag);
737
737
}
738
738
739
- InFlightDiagnostic diagnose (Token Tok, Diagnostic Diag) {
739
+ InFlightDiagnostic diagnose (Token Tok, DiagRef Diag) {
740
740
return diagnose (Tok.getLoc (), Diag);
741
741
}
742
742
743
743
template <typename ...DiagArgTypes, typename ...ArgTypes>
744
744
InFlightDiagnostic diagnose (SourceLoc Loc, Diag<DiagArgTypes...> DiagID,
745
745
ArgTypes &&...Args) {
746
- return diagnose (Loc, Diagnostic ( DiagID, std::forward<ArgTypes>(Args)...) );
746
+ return diagnose (Loc, { DiagID, { std::forward<ArgTypes>(Args)...}} );
747
747
}
748
748
749
749
template <typename ...DiagArgTypes, typename ...ArgTypes>
750
750
InFlightDiagnostic diagnose (Token Tok, Diag<DiagArgTypes...> DiagID,
751
751
ArgTypes &&...Args) {
752
752
return diagnose (Tok.getLoc (),
753
- Diagnostic ( DiagID, std::forward<ArgTypes>(Args)...) );
753
+ { DiagID, { std::forward<ArgTypes>(Args)...}} );
754
754
}
755
755
756
756
// / Add a fix-it to remove the space in consecutive identifiers.
@@ -809,68 +809,68 @@ class Parser {
809
809
// / its name in \p Result. Otherwise, emit an error.
810
810
// /
811
811
// / \returns false on success, true on error.
812
- bool parseIdentifier (Identifier &Result, SourceLoc &Loc, const Diagnostic & D,
812
+ bool parseIdentifier (Identifier &Result, SourceLoc &Loc, DiagRef D,
813
813
bool diagnoseDollarPrefix);
814
814
815
815
// / Consume an identifier with a specific expected name. This is useful for
816
816
// / contextually sensitive keywords that must always be present.
817
817
bool parseSpecificIdentifier (StringRef expected, SourceLoc &Loc,
818
- const Diagnostic & D);
818
+ DiagRef D);
819
819
820
820
template <typename ...DiagArgTypes, typename ...ArgTypes>
821
821
bool parseIdentifier (Identifier &Result, SourceLoc &L,
822
822
bool diagnoseDollarPrefix, Diag<DiagArgTypes...> ID,
823
823
ArgTypes... Args) {
824
- return parseIdentifier (Result, L, Diagnostic ( ID, Args...) ,
824
+ return parseIdentifier (Result, L, { ID, { Args...}} ,
825
825
diagnoseDollarPrefix);
826
826
}
827
827
828
828
template <typename ...DiagArgTypes, typename ...ArgTypes>
829
829
bool parseSpecificIdentifier (StringRef expected,
830
830
Diag<DiagArgTypes...> ID, ArgTypes... Args) {
831
831
SourceLoc L;
832
- return parseSpecificIdentifier (expected, L, Diagnostic ( ID, Args...) );
832
+ return parseSpecificIdentifier (expected, L, { ID, { Args...}} );
833
833
}
834
834
835
835
// / Consume an identifier or operator if present and return its name
836
836
// / in \p Result. Otherwise, emit an error and return true.
837
837
bool parseAnyIdentifier (Identifier &Result, SourceLoc &Loc,
838
- const Diagnostic & D, bool diagnoseDollarPrefix);
838
+ DiagRef D, bool diagnoseDollarPrefix);
839
839
840
840
template <typename ...DiagArgTypes, typename ...ArgTypes>
841
841
bool parseAnyIdentifier (Identifier &Result, bool diagnoseDollarPrefix,
842
842
Diag<DiagArgTypes...> ID, ArgTypes... Args) {
843
843
SourceLoc L;
844
- return parseAnyIdentifier (Result, L, Diagnostic ( ID, Args...) ,
844
+ return parseAnyIdentifier (Result, L, { ID, { Args...}} ,
845
845
diagnoseDollarPrefix);
846
846
}
847
847
848
848
// / \brief Parse an unsigned integer and returns it in \p Result. On failure
849
849
// / emit the specified error diagnostic, and a note at the specified note
850
850
// / location.
851
851
bool parseUnsignedInteger (unsigned &Result, SourceLoc &Loc,
852
- const Diagnostic & D);
852
+ DiagRef D);
853
853
854
854
// / The parser expects that \p K is next token in the input. If so,
855
855
// / it is consumed and false is returned.
856
856
// /
857
857
// / If the input is malformed, this emits the specified error diagnostic.
858
- bool parseToken (tok K, SourceLoc &TokLoc, const Diagnostic & D);
858
+ bool parseToken (tok K, SourceLoc &TokLoc, DiagRef D);
859
859
860
860
template <typename ...DiagArgTypes, typename ...ArgTypes>
861
861
bool parseToken (tok K, Diag<DiagArgTypes...> ID, ArgTypes... Args) {
862
862
SourceLoc L;
863
- return parseToken (K, L, Diagnostic ( ID, Args...) );
863
+ return parseToken (K, L, { ID, { Args...}} );
864
864
}
865
865
template <typename ...DiagArgTypes, typename ...ArgTypes>
866
866
bool parseToken (tok K, SourceLoc &L,
867
867
Diag<DiagArgTypes...> ID, ArgTypes... Args) {
868
- return parseToken (K, L, Diagnostic ( ID, Args...) );
868
+ return parseToken (K, L, { ID, { Args...}} );
869
869
}
870
870
871
871
// / Parse the specified expected token and return its location on success. On failure, emit the specified
872
872
// / error diagnostic, a note at the specified note location, and return the location of the previous token.
873
- bool parseMatchingToken (tok K, SourceLoc &TokLoc, Diagnostic ErrorDiag,
873
+ bool parseMatchingToken (tok K, SourceLoc &TokLoc, DiagRef ErrorDiag,
874
874
SourceLoc OtherLoc);
875
875
876
876
// / Returns the proper location for a missing right brace, parenthesis, etc.
@@ -903,7 +903,7 @@ class Parser {
903
903
904
904
// / Parse a comma separated list of some elements.
905
905
ParserStatus parseList (tok RightK, SourceLoc LeftLoc, SourceLoc &RightLoc,
906
- bool AllowSepAfterLast, Diag<> ErrorDiag ,
906
+ bool AllowSepAfterLast, DiagRef RightErrorDiag ,
907
907
llvm::function_ref<ParserStatus()> callback);
908
908
909
909
void consumeTopLevelDecl (ParserPosition BeginParserPosition,
@@ -1184,7 +1184,7 @@ class Parser {
1184
1184
// / Parse a version tuple of the form x[.y[.z]]. Returns true if there was
1185
1185
// / an error parsing.
1186
1186
bool parseVersionTuple (llvm::VersionTuple &Version, SourceRange &Range,
1187
- const Diagnostic & D);
1187
+ DiagRef D);
1188
1188
1189
1189
bool isParameterSpecifier () {
1190
1190
if (Tok.is (tok::kw_inout)) return true ;
@@ -1832,7 +1832,7 @@ class Parser {
1832
1832
// / unqualified-decl-name:
1833
1833
// / unqualified-decl-base-name
1834
1834
// / unqualified-decl-base-name '(' ((identifier | '_') ':') + ')'
1835
- DeclNameRef parseDeclNameRef (DeclNameLoc &loc, const Diagnostic & diag,
1835
+ DeclNameRef parseDeclNameRef (DeclNameLoc &loc, DiagRef diag,
1836
1836
DeclNameOptions flags);
1837
1837
1838
1838
// / Parse macro expansion.
@@ -1843,7 +1843,7 @@ class Parser {
1843
1843
SourceLoc £Loc, DeclNameLoc ¯oNameLoc, DeclNameRef ¯oNameRef,
1844
1844
SourceLoc &leftAngleLoc, SmallVectorImpl<TypeRepr *> &genericArgs,
1845
1845
SourceLoc &rightAngleLoc, ArgumentList *&argList, bool isExprBasic,
1846
- const Diagnostic & diag);
1846
+ DiagRef diag);
1847
1847
1848
1848
ParserResult<Expr> parseExprIdentifier (bool allowKeyword);
1849
1849
Expr *parseExprEditorPlaceholder (Token PlaceholderTok,
0 commit comments