[clang-tools-extra] [clangd] DefineInline: only trigger on the declaration that has the body (PR #227534)
Aleksandr Platonov via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 29 23:47:46 PDT 2026
================
----------------
ArcsinX wrote:
Maybe we also need a `doesThisDeclarationHaveABody()` check here (but for `Target`).
Otherwise, in case of duplicated definitions, trigger `DefineInline` not at the first definition will lead to the same error.
E.g.
```cpp
// error-ok
void func() {} // Target
void fu^nc {} // Source
// Target != Source => prepare() returns true
```
Moreover, maybe instead of `doesThisDeclarationHaveABody()` we should use `isThisDeclarationADefinition()`, which also returns `true` if `isDeletedAsWritten()` is `true` to handle cases like this:
```cpp
// error-ok
void func() = delete; // Target
void fu^nc() {} // Source
```
https://github.com/llvm/llvm-project/pull/227534
More information about the cfe-commits
mailing list