[clang] [Clang] use colon char instead of token name (PR #144068)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 06:06:39 PDT 2025
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/144068
>From a83afe5aca4f192f378ef4b99477103b23991026 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: Fri, 13 Jun 2025 15:28:20 +0300
Subject: [PATCH 1/2] [Clang] use colon char instead of token name
---
clang/lib/Parse/ParseStmt.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index c00759893b0c4..eb761c3b90523 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -836,8 +836,7 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx,
Diag(ExpectedLoc, diag::err_expected_after)
<< "'case'" << tok::colon
- << FixItHint::CreateInsertion(ExpectedLoc,
- tok::getTokenName(tok::colon));
+ << FixItHint::CreateInsertion(ExpectedLoc, ":");
ColonLoc = ExpectedLoc;
}
>From 302bd61d48299d2cddbf8fbb3a52d707e80bda77 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: Fri, 13 Jun 2025 16:06:29 +0300
Subject: [PATCH 2/2] use punctuator spelling
---
clang/lib/Parse/ParseStmt.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index eb761c3b90523..2df1e941452f0 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -836,7 +836,8 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx,
Diag(ExpectedLoc, diag::err_expected_after)
<< "'case'" << tok::colon
- << FixItHint::CreateInsertion(ExpectedLoc, ":");
+ << FixItHint::CreateInsertion(ExpectedLoc,
+ tok::getPunctuatorSpelling(tok::colon));
ColonLoc = ExpectedLoc;
}
More information about the cfe-commits
mailing list