[clangd] Fix crash in DefineInline::prepare()

This commit is contained in:
Sam McCall 2019-11-11 19:00:44 +01:00
parent eb8710cb93
commit b9213dfec4
2 changed files with 4 additions and 1 deletions

View File

@ -388,7 +388,7 @@ public:
if (!SelNode)
return false;
Source = getSelectedFunction(SelNode);
if (!Source || !Source->isThisDeclarationADefinition())
if (!Source || !Source->hasBody())
return false;
// Only the last level of template parameter locations are not kept in AST,
// so if we are inlining a method that is in a templated class, there is no

View File

@ -920,6 +920,9 @@ TEST_F(DefineInlineTest, TriggersOnFunctionDecl) {
[[(void)(5+3);
return;]]
}]]
// Definition with no body.
class Bar { Bar() = def^ault; }
)cpp");
}