From 11ad7d2935afe965c9e8c7ba4732215b404ff57f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Wed, 5 Apr 2023 13:46:11 +0200 Subject: [PATCH] [clang][Sema][NFC] Save token name instead of the full token Differential Revision: https://reviews.llvm.org/D147615 --- clang/lib/Parse/ParseDeclCXX.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 037bc86..1530d82 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -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(); @@ -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(), -- 2.7.4