Remove uses of StringLiteral in format strings. (#4416)

Building on #4411, avoid using StringLiteral in format strings. This
includes a diagnostic check to prevent regressions (which is also how I
gathered issues).

Note, I haven't looked at `std::string` uses yet, but we might need
things like that to be able to pass strings in code back to the user.
StringLiteral though means that it's literally written down in the
toolchain, at which point it should probably be written in the format
string instead of separately.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
Jon Ross-Perkins
2024-10-21 19:39:53 +00:00
committed by GitHub
co-authored by Geoff Romer
parent 62c36eceda
commit 302aa1bb30
11 changed files with 87 additions and 66 deletions
+2 -2
View File
@@ -77,9 +77,9 @@ auto Context::ConsumeAndAddCloseSymbol(Lex::TokenIndex expected_open,
// TODO: Include the location of the matching opening delimiter in the
// diagnostic.
CARBON_DIAGNOSTIC(ExpectedCloseSymbol, Error,
"unexpected tokens before `{0}`", llvm::StringLiteral);
"unexpected tokens before `{0}`", Lex::TokenKind);
emitter_->Emit(*position_, ExpectedCloseSymbol,
open_token_kind.closing_symbol().fixed_spelling());
open_token_kind.closing_symbol());
SkipTo(tokens().GetMatchedClosingToken(expected_open));
AddNode(close_kind, Consume(), /*has_error=*/true);