[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
Wed Sep 30 01:04:04 PDT 2026


================
@@ -400,7 +400,7 @@ class DefineInline : public Tweak {
     if (!SelNode)
       return false;
     Source = getSelectedFunction(SelNode);
-    if (!Source || !Source->hasBody())
+    if (!Source || !Source->doesThisDeclarationHaveABody())
----------------
ArcsinX wrote:

Thanks for clarification.
Here I am worry about possible `nullptr` dereference at `Source->getBody()->...` below.
If it really can't be `nullptr` in our case and `doesThisDeclarationHaveABody()` check is enough, maybe we can add an assertion for `Source->getBody()`

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


More information about the cfe-commits mailing list