Skip to content

Commit 2cb32e2

Browse files
authored
[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.
1 parent 6464066 commit 2cb32e2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

clang/lib/Parse/ParseStmt.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,7 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx,
836836

837837
Diag(ExpectedLoc, diag::err_expected_after)
838838
<< "'case'" << tok::colon
839-
<< FixItHint::CreateInsertion(ExpectedLoc,
840-
tok::getTokenName(tok::colon));
839+
<< FixItHint::CreateInsertion(ExpectedLoc, ":");
841840

842841
ColonLoc = ExpectedLoc;
843842
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3+
4+
void f(int x) {
5+
switch (x) {
6+
case 1 // expected-error {{expected ':' after 'case'}}
7+
break;
8+
}
9+
}
10+
// CHECK: fix-it:"{{.*}}":{6:11-6:11}:":"

0 commit comments

Comments
 (0)