| 178 | } |
| 179 | |
| 180 | void TestFiles::testFiles() |
| 181 | { |
| 182 | QFETCH(QString, fileName); |
| 183 | |
| 184 | if (QTest::currentDataTag() == QLatin1String("lambdas.cpp")) { |
| 185 | m_provider->parserArguments += "-std=c++14"; |
| 186 | } else if (QTest::currentDataTag() == QLatin1String("templates.cpp")) { |
| 187 | m_provider->parserArguments += "-std=c++17"; |
| 188 | } else if (QTest::currentDataTag() == QLatin1String("types.cpp")) { |
| 189 | if (clangVersionNumber() >= QVersionNumber(18, 0, 0)) { |
| 190 | // without this flag, the top->problems().isEmpty() check below fails at the line `int arr2[argc];` |
| 191 | m_provider->parserArguments += "-Wno-vla-cxx-extension"; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | const IndexedString indexedFileName(fileName); |
| 196 | ReferencedTopDUContext top = |
| 197 | DUChain::self()->waitForUpdate(indexedFileName, TopDUContext::AllDeclarationsContextsAndUses); |
| 198 | QVERIFY(top); |
| 199 | DUChainReadLocker lock; |
| 200 | DeclarationValidator validator(adjustTestData); |
| 201 | top->visit(validator); |
| 202 | |
| 203 | const auto problems = top->problems(); |
| 204 | for (auto& problem : problems) { |
| 205 | qDebug() << problem; |
| 206 | } |
| 207 | |
| 208 | if (clangVersionNumber() < QVersionNumber(9, 0, 0)) |
| 209 | QEXPECT_FAIL("lambdas.cpp", "capture with identifier and initializer aren't visited apparently", Abort); |
| 210 | QVERIFY(validator.testsPassed()); |
| 211 | |
| 212 | if (!QTest::currentDataTag() || strcmp("invalid.cpp", QTest::currentDataTag()) != 0) { |
| 213 | QVERIFY(top->problems().isEmpty()); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | #include "moc_test_files.cpp" |
nothing calls this directly
no test coverage detected