Skip to content

Commit 4126f9b

Browse files
committed
remove duplicate note diagnostic
1 parent dd49533 commit 4126f9b

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

clang/lib/Parse/ParseStmt.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -833,22 +833,14 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx,
833833
<< FixItHint::CreateReplacement(ColonLoc, ":");
834834
} else {
835835
SourceLocation ExpectedLoc = PP.getLocForEndOfToken(PrevTokLocation);
836-
SourceLocation ExprLoc =
837-
LHS.get() ? LHS.get()->getExprLoc() : SourceLocation();
838-
839-
if (ExpectedLoc.isInvalid() && ExprLoc.isMacroID()) {
840-
ExpectedLoc = PP.getSourceManager().getSpellingLoc(ExprLoc);
836+
if (ExpectedLoc.isInvalid() && LHS.get()) {
837+
ExpectedLoc =
838+
PP.getSourceManager().getSpellingLoc(LHS.get()->getExprLoc());
841839
}
842840

843841
Diag(ExpectedLoc, diag::err_expected_after)
844842
<< "'case'" << tok::colon
845-
<< FixItHint::CreateInsertion(ExpectedLoc, ":");
846-
847-
if (ExprLoc.isMacroID()) {
848-
Diag(ExprLoc, diag::note_macro_expansion)
849-
<< Lexer::getImmediateMacroNameForDiagnostics(
850-
ExprLoc, PP.getSourceManager(), getLangOpts());
851-
}
843+
<< FixItHint::CreateInsertion(ExpectedLoc, tok::getTokenName(tok::colon));
852844

853845
ColonLoc = ExpectedLoc;
854846
}

clang/test/Parser/switch-recovery.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ namespace GH143216 {
235235

236236
int f(int x) {
237237
switch (x) {
238-
case FOO // expected-note {{expanded from macro 'FOO'}}
238+
case FOO
239239
return 0;
240240
default:
241241
return 1;

0 commit comments

Comments
 (0)