Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/tests/test_duchain.cpp
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Line(s) | |||||
291 | 291 | | |||
292 | #include "missing2.h" | 292 | #include "missing2.h" | ||
293 | 293 | | |||
294 | class B : public A<int> | 294 | class B : public A<int> | ||
295 | { | 295 | { | ||
296 | }; | 296 | }; | ||
297 | )"; | 297 | )"; | ||
298 | 298 | | |||
299 | // NOTE: This fails and needs fixing. If the include of "missing2.h" | | |||
300 | // above is commented out, then it doesn't fail. Maybe | | |||
301 | // clang stops processing when it encounters the second missing | | |||
302 | // header, or similar. | | |||
303 | | ||||
304 | TestFile header(code, QStringLiteral("h")); | 299 | TestFile header(code, QStringLiteral("h")); | ||
305 | TestFile impl("#include \"" + header.url().str() + "\"\n", QStringLiteral("cpp"), &header); | 300 | TestFile impl("#include \"" + header.url().str() + "\"\n", QStringLiteral("cpp"), &header); | ||
306 | QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsAndUses)); | 301 | QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsAndUses)); | ||
307 | 302 | | |||
308 | DUChainReadLocker lock; | 303 | DUChainReadLocker lock; | ||
309 | 304 | | |||
310 | auto top = impl.topContext(); | 305 | auto top = impl.topContext(); | ||
311 | QVERIFY(top); | 306 | QVERIFY(top); | ||
Show All 12 Lines | 316 | #endif | |||
324 | QCOMPARE(headerCtx->localDeclarations().count(), 2); | 319 | QCOMPARE(headerCtx->localDeclarations().count(), 2); | ||
325 | 320 | | |||
326 | auto a = dynamic_cast<ClassDeclaration*>(headerCtx->localDeclarations().first()); | 321 | auto a = dynamic_cast<ClassDeclaration*>(headerCtx->localDeclarations().first()); | ||
327 | QVERIFY(a); | 322 | QVERIFY(a); | ||
328 | 323 | | |||
329 | auto b = dynamic_cast<ClassDeclaration*>(headerCtx->localDeclarations().last()); | 324 | auto b = dynamic_cast<ClassDeclaration*>(headerCtx->localDeclarations().last()); | ||
330 | QVERIFY(b); | 325 | QVERIFY(b); | ||
331 | 326 | | |||
332 | #if CINDEX_VERSION_MINOR < 34 | 327 | // NOTE: This fails and needs fixing. If the include of "missing2.h" | ||
328 | // above is commented out, then it doesn't fail. Maybe | ||||
329 | // clang stops processing when it encounters the second missing | ||||
330 | // header, or similar. | ||||
331 | // XFAIL this check until https://bugs.llvm.org/show_bug.cgi?id=38155 is fixed | ||||
333 | QEXPECT_FAIL("", "Base class isn't assigned correctly", Continue); | 332 | QEXPECT_FAIL("", "Base class isn't assigned correctly", Continue); | ||
334 | #endif | | |||
335 | QCOMPARE(b->baseClassesSize(), 1u); | 333 | QCOMPARE(b->baseClassesSize(), 1u); | ||
336 | 334 | | |||
337 | #if CINDEX_VERSION_MINOR < 34 | 335 | #if CINDEX_VERSION_MINOR < 34 | ||
338 | // at least the one problem we have should have been propagated | 336 | // at least the one problem we have should have been propagated | ||
339 | QCOMPARE(top->problems().count(), 1); | 337 | QCOMPARE(top->problems().count(), 1); | ||
340 | #else | 338 | #else | ||
341 | // two errors: | 339 | // two errors: | ||
342 | // /tmp/testfile_f32415.h:3:10: error: 'missing1.h' file not found | 340 | // /tmp/testfile_f32415.h:3:10: error: 'missing1.h' file not found | ||
▲ Show 20 Lines • Show All 1747 Lines • Show Last 20 Lines |