@@ -729,28 +729,28 @@ class Parser {
729729 }
730730
731731public:
732- InFlightDiagnostic diagnose (SourceLoc Loc, Diagnostic Diag) {
732+ InFlightDiagnostic diagnose (SourceLoc Loc, DiagRef Diag) {
733733 if (Diags.isDiagnosticPointsToFirstBadToken (Diag.getID ()) &&
734734 Loc == Tok.getLoc () && Tok.isAtStartOfLine ())
735735 Loc = getEndOfPreviousLoc ();
736736 return Diags.diagnose (Loc, Diag);
737737 }
738738
739- InFlightDiagnostic diagnose (Token Tok, Diagnostic Diag) {
739+ InFlightDiagnostic diagnose (Token Tok, DiagRef Diag) {
740740 return diagnose (Tok.getLoc (), Diag);
741741 }
742742
743743 template <typename ...DiagArgTypes, typename ...ArgTypes>
744744 InFlightDiagnostic diagnose (SourceLoc Loc, Diag<DiagArgTypes...> DiagID,
745745 ArgTypes &&...Args) {
746- return diagnose (Loc, Diagnostic ( DiagID, std::forward<ArgTypes>(Args)...) );
746+ return diagnose (Loc, { DiagID, { std::forward<ArgTypes>(Args)...}} );
747747 }
748748
749749 template <typename ...DiagArgTypes, typename ...ArgTypes>
750750 InFlightDiagnostic diagnose (Token Tok, Diag<DiagArgTypes...> DiagID,
751751 ArgTypes &&...Args) {
752752 return diagnose (Tok.getLoc (),
753- Diagnostic ( DiagID, std::forward<ArgTypes>(Args)...) );
753+ { DiagID, { std::forward<ArgTypes>(Args)...}} );
754754 }
755755
756756 // / Add a fix-it to remove the space in consecutive identifiers.
@@ -809,68 +809,68 @@ class Parser {
809809 // / its name in \p Result. Otherwise, emit an error.
810810 // /
811811 // / \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,
813813 bool diagnoseDollarPrefix);
814814
815815 // / Consume an identifier with a specific expected name. This is useful for
816816 // / contextually sensitive keywords that must always be present.
817817 bool parseSpecificIdentifier (StringRef expected, SourceLoc &Loc,
818- const Diagnostic & D);
818+ DiagRef D);
819819
820820 template <typename ...DiagArgTypes, typename ...ArgTypes>
821821 bool parseIdentifier (Identifier &Result, SourceLoc &L,
822822 bool diagnoseDollarPrefix, Diag<DiagArgTypes...> ID,
823823 ArgTypes... Args) {
824- return parseIdentifier (Result, L, Diagnostic ( ID, Args...) ,
824+ return parseIdentifier (Result, L, { ID, { Args...}} ,
825825 diagnoseDollarPrefix);
826826 }
827827
828828 template <typename ...DiagArgTypes, typename ...ArgTypes>
829829 bool parseSpecificIdentifier (StringRef expected,
830830 Diag<DiagArgTypes...> ID, ArgTypes... Args) {
831831 SourceLoc L;
832- return parseSpecificIdentifier (expected, L, Diagnostic ( ID, Args...) );
832+ return parseSpecificIdentifier (expected, L, { ID, { Args...}} );
833833 }
834834
835835 // / Consume an identifier or operator if present and return its name
836836 // / in \p Result. Otherwise, emit an error and return true.
837837 bool parseAnyIdentifier (Identifier &Result, SourceLoc &Loc,
838- const Diagnostic & D, bool diagnoseDollarPrefix);
838+ DiagRef D, bool diagnoseDollarPrefix);
839839
840840 template <typename ...DiagArgTypes, typename ...ArgTypes>
841841 bool parseAnyIdentifier (Identifier &Result, bool diagnoseDollarPrefix,
842842 Diag<DiagArgTypes...> ID, ArgTypes... Args) {
843843 SourceLoc L;
844- return parseAnyIdentifier (Result, L, Diagnostic ( ID, Args...) ,
844+ return parseAnyIdentifier (Result, L, { ID, { Args...}} ,
845845 diagnoseDollarPrefix);
846846 }
847847
848848 // / \brief Parse an unsigned integer and returns it in \p Result. On failure
849849 // / emit the specified error diagnostic, and a note at the specified note
850850 // / location.
851851 bool parseUnsignedInteger (unsigned &Result, SourceLoc &Loc,
852- const Diagnostic & D);
852+ DiagRef D);
853853
854854 // / The parser expects that \p K is next token in the input. If so,
855855 // / it is consumed and false is returned.
856856 // /
857857 // / 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);
859859
860860 template <typename ...DiagArgTypes, typename ...ArgTypes>
861861 bool parseToken (tok K, Diag<DiagArgTypes...> ID, ArgTypes... Args) {
862862 SourceLoc L;
863- return parseToken (K, L, Diagnostic ( ID, Args...) );
863+ return parseToken (K, L, { ID, { Args...}} );
864864 }
865865 template <typename ...DiagArgTypes, typename ...ArgTypes>
866866 bool parseToken (tok K, SourceLoc &L,
867867 Diag<DiagArgTypes...> ID, ArgTypes... Args) {
868- return parseToken (K, L, Diagnostic ( ID, Args...) );
868+ return parseToken (K, L, { ID, { Args...}} );
869869 }
870870
871871 // / Parse the specified expected token and return its location on success. On failure, emit the specified
872872 // / 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,
874874 SourceLoc OtherLoc);
875875
876876 // / Returns the proper location for a missing right brace, parenthesis, etc.
@@ -903,7 +903,7 @@ class Parser {
903903
904904 // / Parse a comma separated list of some elements.
905905 ParserStatus parseList (tok RightK, SourceLoc LeftLoc, SourceLoc &RightLoc,
906- bool AllowSepAfterLast, Diag<> ErrorDiag ,
906+ bool AllowSepAfterLast, DiagRef RightErrorDiag ,
907907 llvm::function_ref<ParserStatus()> callback);
908908
909909 void consumeTopLevelDecl (ParserPosition BeginParserPosition,
@@ -1184,7 +1184,7 @@ class Parser {
11841184 // / Parse a version tuple of the form x[.y[.z]]. Returns true if there was
11851185 // / an error parsing.
11861186 bool parseVersionTuple (llvm::VersionTuple &Version, SourceRange &Range,
1187- const Diagnostic & D);
1187+ DiagRef D);
11881188
11891189 bool isParameterSpecifier () {
11901190 if (Tok.is (tok::kw_inout)) return true ;
@@ -1832,7 +1832,7 @@ class Parser {
18321832 // / unqualified-decl-name:
18331833 // / unqualified-decl-base-name
18341834 // / unqualified-decl-base-name '(' ((identifier | '_') ':') + ')'
1835- DeclNameRef parseDeclNameRef (DeclNameLoc &loc, const Diagnostic & diag,
1835+ DeclNameRef parseDeclNameRef (DeclNameLoc &loc, DiagRef diag,
18361836 DeclNameOptions flags);
18371837
18381838 // / Parse macro expansion.
@@ -1843,7 +1843,7 @@ class Parser {
18431843 SourceLoc £Loc, DeclNameLoc ¯oNameLoc, DeclNameRef ¯oNameRef,
18441844 SourceLoc &leftAngleLoc, SmallVectorImpl<TypeRepr *> &genericArgs,
18451845 SourceLoc &rightAngleLoc, ArgumentList *&argList, bool isExprBasic,
1846- const Diagnostic & diag);
1846+ DiagRef diag);
18471847
18481848 ParserResult<Expr> parseExprIdentifier (bool allowKeyword);
18491849 Expr *parseExprEditorPlaceholder (Token PlaceholderTok,
0 commit comments