================
@@ -833,9 +833,23 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext 
StmtCtx,
           << FixItHint::CreateReplacement(ColonLoc, ":");
     } else {
       SourceLocation ExpectedLoc = PP.getLocForEndOfToken(PrevTokLocation);
+      SourceLocation ExprLoc =
+          LHS.get() ? LHS.get()->getExprLoc() : SourceLocation();
+
+      if (ExpectedLoc.isInvalid() && ExprLoc.isMacroID()) {
+        ExpectedLoc = PP.getSourceManager().getSpellingLoc(ExprLoc);
+      }
+
       Diag(ExpectedLoc, diag::err_expected_after)
           << "'case'" << tok::colon
           << FixItHint::CreateInsertion(ExpectedLoc, ":");
+
+      if (ExprLoc.isMacroID()) {
+        Diag(ExprLoc, diag::note_macro_expansion)
----------------
efriedma-quic wrote:

We usually let the diagnostic infrastructure generate this sort of note; trying 
to write it out is likely to get it wrong.

https://github.com/llvm/llvm-project/pull/143460
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to