This revision was automatically updated to reflect the committed changes. Closed by commit rGb1aba4a10099: [clang][Diagnostics] Don't expand label fixit to the next line (authored by tbaeder).
Changed prior to commit: https://reviews.llvm.org/D152525?vs=529922&id=531737#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152525/new/ https://reviews.llvm.org/D152525 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaDecl.cpp clang/test/FixIt/fixit-newline-style.c Index: clang/test/FixIt/fixit-newline-style.c =================================================================== --- clang/test/FixIt/fixit-newline-style.c +++ clang/test/FixIt/fixit-newline-style.c @@ -5,6 +5,7 @@ // CHECK: warning: unused label 'ddd' // CHECK-NEXT: {{^ ddd:}} // CHECK-NEXT: {{^ \^~~~$}} +// CHECK-NOT: {{^ ;}} void f(void) { ddd: ; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -2096,7 +2096,7 @@ 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( Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -350,6 +350,9 @@ - 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 -------------------------
Index: clang/test/FixIt/fixit-newline-style.c =================================================================== --- clang/test/FixIt/fixit-newline-style.c +++ clang/test/FixIt/fixit-newline-style.c @@ -5,6 +5,7 @@ // CHECK: warning: unused label 'ddd' // CHECK-NEXT: {{^ ddd:}} // CHECK-NEXT: {{^ \^~~~$}} +// CHECK-NOT: {{^ ;}} void f(void) { ddd: ; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -2096,7 +2096,7 @@ 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( Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -350,6 +350,9 @@ - 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 -------------------------
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits