[clang] [Clang] fix missing source location for errors in macro-expanded (PR #143460)
Ross Kirsling via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 04:46:42 PDT 2025
================
@@ -832,10 +832,13 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx,
<< "'case'" << tok::colon
<< FixItHint::CreateReplacement(ColonLoc, ":");
} else {
- SourceLocation ExpectedLoc = PP.getLocForEndOfToken(PrevTokLocation);
+ SourceLocation ExpectedLoc = getEndOfPreviousToken();
+
Diag(ExpectedLoc, diag::err_expected_after)
<< "'case'" << tok::colon
- << FixItHint::CreateInsertion(ExpectedLoc, ":");
+ << FixItHint::CreateInsertion(ExpectedLoc,
+ tok::getTokenName(tok::colon));
----------------
rkirsling wrote:
Whoops, looks like this caused the word `colon` to be displayed instead of `:`.
https://godbolt.org/z/rjzdsKqqh
https://github.com/llvm/llvm-project/pull/143460
More information about the cfe-commits
mailing list