| 692 | } |
| 693 | |
| 694 | void TestDUChain::testReparseBaseClasses() |
| 695 | { |
| 696 | TestFile file(QStringLiteral("struct a{}; struct b : a {};\n"), QStringLiteral("cpp")); |
| 697 | file.parse(TopDUContext::AllDeclarationsContextsAndUses); |
| 698 | |
| 699 | for (int i = 0; i < 2; ++i) { |
| 700 | qDebug() << "run: " << i; |
| 701 | QVERIFY(file.waitForParsed(500)); |
| 702 | DUChainWriteLocker lock; |
| 703 | QVERIFY(file.topContext()); |
| 704 | QCOMPARE(file.topContext()->childContexts().size(), 2); |
| 705 | QCOMPARE(file.topContext()->childContexts().first()->importers().size(), 1); |
| 706 | QCOMPARE(file.topContext()->childContexts().last()->importedParentContexts().size(), 1); |
| 707 | |
| 708 | QCOMPARE(file.topContext()->localDeclarations().size(), 2); |
| 709 | auto aDecl = dynamic_cast<ClassDeclaration*>(file.topContext()->localDeclarations().first()); |
| 710 | QVERIFY(aDecl); |
| 711 | QCOMPARE(aDecl->baseClassesSize(), 0u); |
| 712 | auto bDecl = dynamic_cast<ClassDeclaration*>(file.topContext()->localDeclarations().last()); |
| 713 | QVERIFY(bDecl); |
| 714 | QCOMPARE(bDecl->baseClassesSize(), 1u); |
| 715 | int distance = 0; |
| 716 | QVERIFY(bDecl->isPublicBaseClass(aDecl, file.topContext(), &distance)); |
| 717 | QCOMPARE(distance, 1); |
| 718 | |
| 719 | file.parse(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::ForceUpdateRecursive); |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | void TestDUChain::testReparseBaseClassesTemplates() |
| 724 | { |
nothing calls this directly
no test coverage detected