MCPcopy Create free account
hub / github.com/KDE/kdevelop / validCandidateToMoveIntoSource

Method validCandidateToMoveIntoSource

plugins/clang/codegen/clangrefactoring.cpp:100–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100bool ClangRefactoring::validCandidateToMoveIntoSource(Declaration* decl)
101{
102 if (!decl || !decl->isFunctionDeclaration() || !decl->type<FunctionType>()) {
103 return false;
104 }
105
106 if (!decl->internalContext() || decl->internalContext()->type() != DUContext::Function) {
107 return false;
108 }
109
110 if (!decl->isDefinition()) {
111 return false;
112 }
113
114 auto childCtx = decl->internalContext()->childContexts();
115 if (childCtx.isEmpty()) {
116 return false;
117 }
118
119 auto ctx = childCtx.first();
120 if (!ctx || ctx->type() != DUContext::Other) {
121 return false;
122 }
123
124 auto functionDecl = dynamic_cast<AbstractFunctionDeclaration*>(decl);
125 if (!functionDecl || functionDecl->isInline()) {
126 return false;
127 }
128
129 return true;
130}
131
132QString ClangRefactoring::moveIntoSource(const IndexedDeclaration& iDecl)
133{

Callers

nothing calls this directly

Calls 8

isDefinitionMethod · 0.80
childContextsMethod · 0.80
isInlineMethod · 0.80
isFunctionDeclarationMethod · 0.45
internalContextMethod · 0.45
typeMethod · 0.45
isEmptyMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected