Skip to content

Commit 971c095

Browse files
committed
remove duplicate note diagnostic
1 parent dd49533 commit 971c095

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ let CategoryName = "Parse Issue" in {
8383
def err_expected : Error<"expected %0">;
8484
def err_expected_either : Error<"expected %0 or %1">;
8585
def err_expected_after : Error<"expected %1 after %0">;
86-
def note_macro_expansion : Note<"expanded from macro '%0'">;
8786

8887
def err_param_redefinition : Error<"redefinition of parameter %0">;
8988
def warn_method_param_redefinition : Warning<"redefinition of method parameter %0">;

clang/lib/Parse/ParseStmt.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -833,22 +833,15 @@ 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,
844+
tok::getTokenName(tok::colon));
852845

853846
ColonLoc = ExpectedLoc;
854847
}

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)