Issue 71419
Summary bug: clangd: fix of 'modernize-use-override' leaves extra spaces
Labels new issue
Assignees
Reporter pavel-the-best
    ## Example
```c++
struct Base {
 virtual void f();
};

struct Derived : Base {
    void f() override final {
    }
};
```

Diagnostic `'override' is redundant since the function is already declared 'final' (fix available) [modernize-use-override]` is shown on `Derived::f`, and fix `remove 'override'` is suggested.

## Expected behavior
When applying the suggested fix the relevant line turns into:
```c++
    void f() final {
```

## Actual behavior
The relevant line turns into:
```c++
    void f()  final {
```

Note the extra space before `final`.

This seems to be a problem with `clangd`, because `clang-tidy -config="{Checks: '-*,modernize-use-override' }" --fix example.cpp` behaves exactly as expected: no extra spaces.

## Context
```
$ clangd --version
clangd version 17.0.3
Features: linux
Platform: x86_64-pc-linux-gnu
$ clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 17.0.3
  Optimized build.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to