[PATCH] D150191: [clang][Diagnostics] Provide a source range for 'use of undeclared identifier' diagnostics
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 12 07:20:13 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:2187
else
- SemaRef.Diag(TypoLoc, DiagnosticID) << Typo;
+ SemaRef.Diag(TypoRange.getEnd(), DiagnosticID) << Typo;
return;
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > I'm not passing the `TypoRange` here now, which regresses the test case I posted. Apparently the handling of `-fmacro-backtrace-limit` depends on the range passed here? That seems weird.
> > Is it failing within `checkRangesForMacroArgExpansion()` in DiagnosticRenderer.cpp? It looks like this change effectively undoes the work from ecd36ee80b7a6ac73c84da19f8a75c4c025a7625
> Well yes, the test case below simply didn't have any source ranges before (`Ranges` was empty), but now it does. The code behaves as expected I assume, just that... it doesn't do what I'd expect it to do. And it doesn't do what the test case below expects either.
>
> I agree that the output before this patch is better (for the below test case), but the output shouldn't be affected by the source range we pass :/
Yeah, but I think you'll have to solve this issue before we can land these changes.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150191/new/
https://reviews.llvm.org/D150191
More information about the cfe-commits
mailing list