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

Method addBaseClass

kdevplatform/language/codegen/templateclassgenerator.cpp:312–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312void TemplateClassGenerator::addBaseClass(const QString& base)
313{
314 Q_D(TemplateClassGenerator);
315
316 const InheritanceDescription desc = descriptionFromString(base);
317
318 ClassDescription cd = description();
319 cd.baseClasses << desc;
320 setDescription(cd);
321
322 //Search for all super classes
323 auto visitor = [&](const IndexedDeclaration& indexedDeclaration) {
324 auto declaration = DeclarationPointer(indexedDeclaration.declaration());
325 if (!declaration || declaration->isForwardDeclaration()) {
326 return PersistentSymbolTable::VisitorState::Continue;
327 }
328
329 // Check if it's a class/struct/etc
330 if (declaration->type<StructureType>()) {
331 d->fetchSuperClasses(declaration);
332 d->directBaseClasses << declaration;
333 return PersistentSymbolTable::VisitorState::Break;
334 }
335 return PersistentSymbolTable::VisitorState::Continue;
336 };
337 const auto id = IndexedQualifiedIdentifier(QualifiedIdentifier(desc.baseType));
338
339 DUChainReadLocker lock;
340 PersistentSymbolTable::self().visitDeclarations(id, visitor);
341}
342
343void TemplateClassGenerator::setBaseClasses(const QList<QString>& bases)
344{

Callers 1

loadTemplateMethod · 0.45

Calls 7

descriptionFromStringFunction · 0.85
fetchSuperClassesMethod · 0.80
visitDeclarationsMethod · 0.80
QualifiedIdentifierClass · 0.50
declarationMethod · 0.45
isForwardDeclarationMethod · 0.45

Tested by 1

loadTemplateMethod · 0.36