Author: Ross Kirsling
Date: 2025-06-14T15:03:23+02:00
New Revision: 2cb32e29408a6c598072ea0f066a246957be69f9

URL: 
https://github.com/llvm/llvm-project/commit/2cb32e29408a6c598072ea0f066a246957be69f9
DIFF: 
https://github.com/llvm/llvm-project/commit/2cb32e29408a6c598072ea0f066a246957be69f9.diff

LOG: [Clang] Fix fix-it hint regression from #143460 (#144069)

Following #143460, `:` began displaying as `colon` in the fix-it hint
for a `case` with a missing colon, as is visible in the description of
(the separate bug) #144052.

This PR simply reverts a line that didn't need to be changed.

Added: 
    clang/test/FixIt/fixit-punctuator-spelling.cpp

Modified: 
    clang/lib/Parse/ParseStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 434ea68442819..c0c9bbc2e15c6 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;
     }

diff  --git a/clang/test/FixIt/fixit-punctuator-spelling.cpp 
b/clang/test/FixIt/fixit-punctuator-spelling.cpp
new file mode 100644
index 0000000000000..3cba0e7b64594
--- /dev/null
+++ b/clang/test/FixIt/fixit-punctuator-spelling.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | 
FileCheck %s
+
+void f(int x) {
+  switch (x) {
+    case 1 // expected-error {{expected ':' after 'case'}}
+      break;
+  }
+}
+// CHECK: fix-it:"{{.*}}":{6:11-6:11}:":"


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to