mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:11:05 +01:00
Clean up SimpleDiagnostic inheritance (#1004)
This commit is contained in:
@@ -17,27 +17,27 @@ namespace Carbon {
|
||||
using LexerDiagnosticEmitter = DiagnosticEmitter<const char*>;
|
||||
|
||||
struct ContentBeforeStringTerminator
|
||||
: SimpleDiagnostic<ContentBeforeStringTerminator> {
|
||||
: DiagnosticBase<ContentBeforeStringTerminator> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Only whitespace is permitted before the closing `\"\"\"` of a "
|
||||
"multi-line string.";
|
||||
};
|
||||
|
||||
struct UnicodeEscapeTooLarge : SimpleDiagnostic<UnicodeEscapeTooLarge> {
|
||||
struct UnicodeEscapeTooLarge : DiagnosticBase<UnicodeEscapeTooLarge> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Code point specified by `\\u{...}` escape is greater than 0x10FFFF.";
|
||||
};
|
||||
|
||||
struct UnicodeEscapeSurrogate : SimpleDiagnostic<UnicodeEscapeSurrogate> {
|
||||
struct UnicodeEscapeSurrogate : DiagnosticBase<UnicodeEscapeSurrogate> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Code point specified by `\\u{...}` escape is a surrogate character.";
|
||||
};
|
||||
|
||||
struct UnicodeEscapeMissingBracedDigits
|
||||
: SimpleDiagnostic<UnicodeEscapeMissingBracedDigits> {
|
||||
: DiagnosticBase<UnicodeEscapeMissingBracedDigits> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Escape sequence `\\u` must be followed by a braced sequence of "
|
||||
@@ -45,30 +45,30 @@ struct UnicodeEscapeMissingBracedDigits
|
||||
};
|
||||
|
||||
struct HexadecimalEscapeMissingDigits
|
||||
: SimpleDiagnostic<HexadecimalEscapeMissingDigits> {
|
||||
: DiagnosticBase<HexadecimalEscapeMissingDigits> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Escape sequence `\\x` must be followed by two "
|
||||
"uppercase hexadecimal digits, for example `\\x0F`.";
|
||||
};
|
||||
|
||||
struct DecimalEscapeSequence : SimpleDiagnostic<DecimalEscapeSequence> {
|
||||
struct DecimalEscapeSequence : DiagnosticBase<DecimalEscapeSequence> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Decimal digit follows `\\0` escape sequence. Use `\\x00` instead of "
|
||||
"`\\0` if the next character is a digit.";
|
||||
};
|
||||
|
||||
struct UnknownEscapeSequence {
|
||||
struct UnknownEscapeSequence : DiagnosticBase<UnknownEscapeSequence> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr const char* Message = "Unrecognized escape sequence `{0}`.";
|
||||
|
||||
char first;
|
||||
|
||||
auto Format() -> std::string { return llvm::formatv(Message, first).str(); }
|
||||
|
||||
char first;
|
||||
};
|
||||
|
||||
struct MismatchedIndentInString : SimpleDiagnostic<MismatchedIndentInString> {
|
||||
struct MismatchedIndentInString : DiagnosticBase<MismatchedIndentInString> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Indentation does not match that of the closing \"\"\" in multi-line "
|
||||
@@ -76,7 +76,7 @@ struct MismatchedIndentInString : SimpleDiagnostic<MismatchedIndentInString> {
|
||||
};
|
||||
|
||||
struct InvalidHorizontalWhitespaceInString
|
||||
: SimpleDiagnostic<InvalidHorizontalWhitespaceInString> {
|
||||
: DiagnosticBase<InvalidHorizontalWhitespaceInString> {
|
||||
static constexpr llvm::StringLiteral ShortName = "syntax-invalid-string";
|
||||
static constexpr llvm::StringLiteral Message =
|
||||
"Whitespace other than plain space must be expressed with an escape "
|
||||
|
||||
Reference in New Issue
Block a user