Skip to content

Conversation

@a-tarasyuk
Copy link
Member

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jun 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2025

@llvm/pr-subscribers-clang

Author: Oleksandr T. (a-tarasyuk)

Changes

Fixes regression of https://github.com/llvm/llvm-project/pull/143460/files#r2144925614


Full diff: https://github.com/llvm/llvm-project/pull/144068.diff

1 Files Affected:

  • (modified) clang/lib/Parse/ParseStmt.cpp (+1-2)
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;
     }

@a-tarasyuk
Copy link
Member Author

/cc @rkirsling

@a-tarasyuk a-tarasyuk requested a review from AaronBallman June 13, 2025 13:02
Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test?

@rkirsling
Copy link
Member

rkirsling commented Jun 13, 2025

Ohh, you beat me by a minute. 😆 I suppose #144069 could be closed then.

@a-tarasyuk a-tarasyuk requested a review from Fznamznon June 13, 2025 13:40
Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one also LGTM, I don't have a strong preference for this PR or the other one. :-)

@a-tarasyuk
Copy link
Member Author

a-tarasyuk commented Jun 13, 2025

Ohh, you beat me by a minute. 😆 I suppose #144069 could be closed then.

@rkirsling You can copy the tests/changes from this PR into yours — I'll close this one.

@rkirsling
Copy link
Member

I believe I'd need somebody to hit the merge button for me regardless, so I think we can just merge whichever one and close the other. 😅 The two approaches are mostly the same, I just figured that the surrounding code was consistent in using a literal ":", while there doesn't seem to be a precedent for using tok::getPunctuatorSpelling with a constant.

Either way, sorry to cause a run-around!

@a-tarasyuk
Copy link
Member Author

@rkirsling
Copy link
Member

rkirsling commented Jun 13, 2025

Oh oops! Thanks for the correction.

Edit: Fixed now.

@a-tarasyuk a-tarasyuk closed this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants