| 814 | } |
| 815 | |
| 816 | void TestDUChain::testFunctionDefinitionVsDeclaration() |
| 817 | { |
| 818 | TestFile file(QStringLiteral("void func(); void func() {}\n"), QStringLiteral("cpp")); |
| 819 | file.parse(TopDUContext::AllDeclarationsContextsAndUses); |
| 820 | QVERIFY(file.waitForParsed()); |
| 821 | |
| 822 | DUChainReadLocker lock; |
| 823 | QVERIFY(file.topContext()); |
| 824 | QCOMPARE(file.topContext()->localDeclarations().size(), 2); |
| 825 | auto funcDecl = file.topContext()->localDeclarations()[0]; |
| 826 | QVERIFY(!funcDecl->isDefinition()); |
| 827 | QVERIFY(!dynamic_cast<FunctionDefinition*>(funcDecl)); |
| 828 | auto funcDef = file.topContext()->localDeclarations()[1]; |
| 829 | QVERIFY(dynamic_cast<FunctionDefinition*>(funcDef)); |
| 830 | QVERIFY(funcDef->isDefinition()); |
| 831 | } |
| 832 | |
| 833 | void TestDUChain::testEnsureNoDoubleVisit() |
| 834 | { |
nothing calls this directly
no test coverage detected