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

Method testVirtualMemberFunction

plugins/clang/tests/test_duchain.cpp:652–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652void TestDUChain::testVirtualMemberFunction()
653{
654 //Forward-declarations with "struct" or "class" are considered equal, so make sure the override is detected correctly.
655 TestFile file(QStringLiteral("struct S {}; struct A { virtual S* ret(); }; struct B : public A { virtual S* ret(); };"), QStringLiteral("cpp"));
656 QVERIFY(file.parseAndWait());
657
658 DUChainReadLocker lock;
659 DUContext* top = file.topContext().data();
660 QVERIFY(top);
661
662 QCOMPARE(top->childContexts().count(), 3);
663 QCOMPARE(top->localDeclarations().count(), 3);
664 QCOMPARE(top->childContexts()[2]->localDeclarations().count(), 1);
665 Declaration* decl = top->childContexts()[2]->localDeclarations()[0];
666 QCOMPARE(decl->identifier(), Identifier(u"ret"));
667 QVERIFY(DUChainUtils::overridden(decl));
668}
669
670void TestDUChain::testBaseClasses()
671{

Callers

nothing calls this directly

Calls 8

parseAndWaitMethod · 0.80
childContextsMethod · 0.80
localDeclarationsMethod · 0.80
IdentifierFunction · 0.50
dataMethod · 0.45
topContextMethod · 0.45
countMethod · 0.45
identifierMethod · 0.45

Tested by

no test coverage detected