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

Method startVisiting

plugins/cmake/duchain/declarationbuilder.cpp:14–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace KDevelop;
13
14void DeclarationBuilder::startVisiting(CMakeContentIterator* node)
15{
16 for(; node->hasNext(); ) {
17 const CMakeFunctionDesc& func = node->next();
18
19 if (func.name == QLatin1String("add_executable") || func.name == QLatin1String("add_library")) {
20 if (func.arguments.isEmpty()) {
21 continue;
22 }
23 CMakeFunctionArgument arg = func.arguments.first();
24
25 DUChainWriteLocker lock;
26 auto* decl = openDeclaration<Declaration>(Identifier(arg.value), arg.range(), DeclarationIsDefinition);
27 decl->setAbstractType(AbstractType::Ptr(new TargetType));
28 closeDeclaration();
29 } else if(func.name == QLatin1String("macro") || func.name == QLatin1String("function")) {
30 if (func.arguments.isEmpty()) {
31 continue;
32 }
33 CMakeFunctionArgument arg = func.arguments.first();
34 FunctionType::Ptr funcType(new FunctionType);
35
36 auto it=func.arguments.constBegin()+1, itEnd = func.arguments.constEnd();
37 for (; it!=itEnd; ++it)
38 {
39 DelayedType::Ptr delayed(new DelayedType);
40 delayed->setIdentifier( IndexedTypeIdentifier(it->value) );
41 funcType->addArgument(delayed);
42 }
43
44 DUChainWriteLocker lock;
45 auto* decl = openDeclaration<FunctionDeclaration>(Identifier(arg.value), arg.range(), DeclarationIsDefinition);
46 decl->setAbstractType( funcType );
47 closeDeclaration();
48 }
49 }
50}

Callers

nothing calls this directly

Calls 13

closeDeclarationFunction · 0.85
constBeginMethod · 0.80
constEndMethod · 0.80
IdentifierFunction · 0.50
hasNextMethod · 0.45
nextMethod · 0.45
isEmptyMethod · 0.45
firstMethod · 0.45
rangeMethod · 0.45
setAbstractTypeMethod · 0.45
setIdentifierMethod · 0.45

Tested by

no test coverage detected