| 650 | } |
| 651 | |
| 652 | void 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 | |
| 670 | void TestDUChain::testBaseClasses() |
| 671 | { |
nothing calls this directly
no test coverage detected