[clang-tools-extra] [clangd] Clean formatting modernize-use-override (PR #81435)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 11 14:31:31 PST 2024


================
@@ -228,8 +228,8 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
   if (HasVirtual) {
     for (Token Tok : Tokens) {
       if (Tok.is(tok::kw_virtual)) {
-        Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
-            Tok.getLocation(), Tok.getLocation()));
+        Diag << FixItHint::CreateRemoval(CharSourceRange::getCharRange(
+            Tok.getLocation(), Tok.getEndLoc().getLocWithOffset(1)));
----------------
PiotrZSL wrote:

Won't work if there are two spaces. You should use LexerUtils::findNextTokenIncludingComments, and then take location -1

https://github.com/llvm/llvm-project/pull/81435


More information about the cfe-commits mailing list