mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-27 13:57:52 +00:00
[clang][Diagnostics] Don't expand label fixit to the next line
Now that we print >1 line of code snippet, we printed another line of code for now reason, because the source range we created for the fixit expanded to the next line, if the next token was there. Don't do that. Differential Revision: https://reviews.llvm.org/D152525
This commit is contained in:
parent
8a257aebeb
commit
b1aba4a100
@ -350,6 +350,9 @@ Improvements to Clang's diagnostics
|
||||
- Clang no longer diagnoses a read of an empty structure as use of an
|
||||
uninitialized variable.
|
||||
(`#26842: <https://github.com/llvm/llvm-project/issues/26842>`_)
|
||||
- The Fix-It emitted for unused labels used to expand to the next line, which caused
|
||||
visual oddities now that Clang shows more than one line of code snippet. This has
|
||||
been fixed and the Fix-It now only spans to the end of the ``:``.
|
||||
|
||||
Bug Fixes in This Version
|
||||
-------------------------
|
||||
|
@ -2096,7 +2096,7 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx,
|
||||
if (isa<LabelDecl>(D)) {
|
||||
SourceLocation AfterColon = Lexer::findLocationAfterToken(
|
||||
D->getEndLoc(), tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(),
|
||||
true);
|
||||
/*SkipTrailingWhitespaceAndNewline=*/false);
|
||||
if (AfterColon.isInvalid())
|
||||
return;
|
||||
Hint = FixItHint::CreateRemoval(
|
||||
|
@ -5,6 +5,7 @@
|
||||
// CHECK: warning: unused label 'ddd'
|
||||
// CHECK-NEXT: {{^ ddd:}}
|
||||
// CHECK-NEXT: {{^ \^~~~$}}
|
||||
// CHECK-NOT: {{^ ;}}
|
||||
void f(void) {
|
||||
ddd:
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user