@@ -38,9 +38,6 @@ struct SourceRange {
3838// Diagnostics class to manage error messages.
3939class Diagnostics {
4040public:
41- // Parser context types.
42- enum ContextType { CT_MatcherArg, CT_MatcherConstruct };
43-
4441 // All errors from the system.
4542 enum ErrorType {
4643 ET_None,
@@ -92,6 +89,22 @@ class Diagnostics {
9289 Diagnostics *const error;
9390 };
9491
92+ // Add an error message with the specified range and error type.
93+ // Returns an ArgStream object to allow constructing the error message using
94+ // the << operator.
95+ ArgStream addError (SourceRange range, ErrorType error);
96+
97+ // Print all error messages to the specified output stream.
98+ void print (llvm::raw_ostream &OS) const ;
99+
100+ // Print the full error messages, including the context information, to the
101+ // specified output stream.
102+ void printFull (llvm::raw_ostream &OS) const ;
103+
104+ private:
105+ // Parser context types.
106+ enum ContextType { CT_MatcherArg, CT_MatcherConstruct };
107+
95108 // Context for managing overloaded matcher construction.
96109 struct OverloadContext {
97110 // Construct an overload context with the given error.
@@ -105,11 +118,6 @@ class Diagnostics {
105118 unsigned beginIndex{};
106119 };
107120
108- // Add an error message with the specified range and error type.
109- // Returns an ArgStream object to allow constructing the error message using
110- // the << operator.
111- ArgStream addError (SourceRange range, ErrorType error);
112-
113121 // Information stored for one frame of the context.
114122 struct ContextFrame {
115123 ContextType type;
@@ -131,14 +139,18 @@ class Diagnostics {
131139 // Get an array reference to the error contents.
132140 llvm::ArrayRef<ErrorContent> errors () const { return errorValues; }
133141
134- // Print all error messages to the specified output stream.
135- void print (llvm::raw_ostream &OS) const ;
142+ llvm::StringRef contextTypeToFormatString (ContextType type) const ;
136143
137- // Print the full error messages, including the context information, to the
138- // specified output stream.
139- void printFull (llvm::raw_ostream &OS) const ;
144+ void printContextFrameToStream (const ContextFrame &frame,
145+ llvm::raw_ostream &OS) const ;
146+
147+ void printMessageToStream (const ErrorContent::Message &message,
148+ const llvm::Twine Prefix,
149+ llvm::raw_ostream &OS) const ;
150+
151+ void printErrorContentToStream (const ErrorContent &content,
152+ llvm::raw_ostream &OS) const ;
140153
141- private:
142154 // Push a new context frame onto the context stack with the specified type and
143155 // range.
144156 ArgStream pushContextFrame (ContextType type, SourceRange range);
0 commit comments