[clang] 11ad7d2 - [clang][Sema][NFC] Save token name instead of the full token
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 8 00:03:07 PDT 2023
Author: Timm Bäder
Date: 2023-04-08T09:02:19+02:00
New Revision: 11ad7d2935afe965c9e8c7ba4732215b404ff57f
URL: https://github.com/llvm/llvm-project/commit/11ad7d2935afe965c9e8c7ba4732215b404ff57f
DIFF: https://github.com/llvm/llvm-project/commit/11ad7d2935afe965c9e8c7ba4732215b404ff57f.diff
LOG: [clang][Sema][NFC] Save token name instead of the full token
Differential Revision: https://reviews.llvm.org/D147615
Added:
Modified:
clang/lib/Parse/ParseDeclCXX.cpp
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 037bc869c5a1..1530d824c345 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(),
More information about the cfe-commits
mailing list