Skip to content

Commit

Permalink
[clang][Sema][NFC] Save token name instead of the full token
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D147615
  • Loading branch information
tbaederr committed Apr 8, 2023
1 parent e7f55bb commit 11ad7d2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,8 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd) {
assert(Tok.isOneOf(tok::kw_static_assert, tok::kw__Static_assert) &&
"Not a static_assert declaration");

// Save the token used for static assertion.
Token SavedTok = Tok;
// Save the token name used for static assertion.
const char *TokName = Tok.getName();

if (Tok.is(tok::kw__Static_assert) && !getLangOpts().C11)
Diag(Tok, diag::ext_c11_feature) << Tok.getName();
Expand Down Expand Up @@ -1027,9 +1027,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd) {
T.consumeClose();

DeclEnd = Tok.getLocation();
// Passing the token used to the error message.
ExpectAndConsumeSemi(diag::err_expected_semi_after_static_assert,
SavedTok.getName());
ExpectAndConsumeSemi(diag::err_expected_semi_after_static_assert, TokName);

return Actions.ActOnStaticAssertDeclaration(StaticAssertLoc, AssertExpr.get(),
AssertMessage.get(),
Expand Down

0 comments on commit 11ad7d2

Please sign in to comment.