Commit 275d8778 authored by Milian Wolff's avatar Milian Wolff

Unbreak move-into-source for non-class functions

We only want to move definitions, not declarations - the code
checked the wrong thing. Additionally, it turns out that we actually
didn't set the 'isDefinition' correctly on inline class functions.

Fixes test_assistants
parent 27dcd076
......@@ -122,7 +122,7 @@ bool ClangRefactoring::validCandidateToMoveIntoSource(Declaration* decl)
return false;
}
if (dynamic_cast<FunctionDefinition*>(decl)) {
if (!decl->isDefinition()) {
return false;
}
......
......@@ -1064,6 +1064,10 @@ void Visitor::setDeclData(CXCursor cursor, ClassMemberDeclaration *decl) const
decl->setAlignOf(alignOf);
}
#endif
if (clang_isCursorDefinition(cursor)) {
decl->setDeclarationIsDefinition(true);
}
}
template<CXCursorKind CK, EnableIf<CursorKindTraits::isClassTemplate(CK)>>
......
struct foo
{
/// "isDefinition": true
foo() {}
/// "isDefinition": true
~foo() {}
/// "isDefinition": true
void blub() {}
};
struct bar
{
/// "isDefinition": false
bar();
/// "isDefinition": false
~bar();
/// "isDefinition": false
void blub();
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment