Update basic diagnostic capitalization/punctuation (#4328)

This is a primarily automated change:

- Search & replace for capitalization
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s")([A-Z])`
    - `$1\L$2`
- Search & replace for period
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s"(?:[^)]|\n)+)\.("[,)])`
    - `$1$2`
- Limited search & replace for `ERROR: ` -> `error: ` in streamed things
- Leaving a TODO for command_line because there's more cleanup that can
be done there
- Modify diagnostic_consumer.cpp
    - ERROR -> error
    - WARNING -> warning

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2024-09-19 21:32:53 +00:00
committed by GitHub
co-authored by Richard Smith
parent 7f6d684b29
commit e7aebbe581
578 changed files with 2166 additions and 2173 deletions
+6 -7
View File
@@ -13,14 +13,13 @@ static auto DiagnoseNotAllowed(Context& context, Parse::NodeId modifier_node,
llvm::StringRef context_string,
SemIR::LocId context_loc_id) -> void {
CARBON_DIAGNOSTIC(ModifierNotAllowedOn, Error,
"`{0}` not allowed on `{1}` declaration{2}.",
Lex::TokenKind, Lex::TokenKind, std::string);
"`{0}` not allowed on `{1}` declaration{2}", Lex::TokenKind,
Lex::TokenKind, std::string);
auto diag = context.emitter().Build(modifier_node, ModifierNotAllowedOn,
context.token_kind(modifier_node),
decl_kind, context_string.str());
if (context_loc_id.is_valid()) {
CARBON_DIAGNOSTIC(ModifierNotInContext, Note,
"Containing definition here.");
CARBON_DIAGNOSTIC(ModifierNotInContext, Note, "containing definition here");
diag.Note(context_loc_id, ModifierNotInContext);
}
diag.Emit();
@@ -136,7 +135,7 @@ auto RestrictExternModifierOnDecl(Context& context,
// This prints an error for `extern library`, but doesn't drop it because we
// assume there is some other, correct value that we just don't know here.
CARBON_DIAGNOSTIC(ExternLibraryIsCurrentLibrary, Error,
"`extern library` cannot specify the current library.");
"`extern library` cannot specify the current library");
context.emitter().Emit(introducer.modifier_node_id(ModifierOrder::Extern),
ExternLibraryIsCurrentLibrary);
introducer.extern_library = SemIR::LibraryNameId::Error;
@@ -145,8 +144,8 @@ auto RestrictExternModifierOnDecl(Context& context,
if (is_definition && introducer.extern_library.is_valid()) {
CARBON_DIAGNOSTIC(ExternLibraryOnDefinition, Error,
"A library cannot be provided for an `extern` modifier "
"on a definition.");
"a library cannot be provided for an `extern` modifier "
"on a definition");
context.emitter().Emit(introducer.modifier_node_id(ModifierOrder::Extern),
ExternLibraryOnDefinition);
}