| 12 | using namespace KDevelop; |
| 13 | |
| 14 | void 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 | } |
nothing calls this directly
no test coverage detected