Changeset View
Changeset View
Standalone View
Standalone View
languages/clang/tests/test_duchain.cpp
Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Line(s) | 227 | QTest::newRow("typedef") | |||
---|---|---|---|---|---|
229 | << AbstractType::TypeAlias; | 229 | << AbstractType::TypeAlias; | ||
230 | } | 230 | } | ||
231 | 231 | | |||
232 | void TestDUChain::testInclude() | 232 | void TestDUChain::testInclude() | ||
233 | { | 233 | { | ||
234 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | 234 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | ||
235 | // NOTE: header is _not_ explicitly being parsed, instead the impl job does that | 235 | // NOTE: header is _not_ explicitly being parsed, instead the impl job does that | ||
236 | 236 | | |||
237 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n" | 237 | TestFile impl("#include \"" + header.url().str() + "\"\n" | ||
238 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | 238 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | ||
239 | impl.parse(TopDUContext::AllDeclarationsContextsAndUses); | 239 | impl.parse(TopDUContext::AllDeclarationsContextsAndUses); | ||
240 | 240 | | |||
241 | auto implCtx = impl.topContext(); | 241 | auto implCtx = impl.topContext(); | ||
242 | QVERIFY(implCtx); | 242 | QVERIFY(implCtx); | ||
243 | 243 | | |||
244 | DUChainReadLocker lock; | 244 | DUChainReadLocker lock; | ||
245 | QCOMPARE(implCtx->localDeclarations().size(), 1); | 245 | QCOMPARE(implCtx->localDeclarations().size(), 1); | ||
Show All 32 Lines | 277 | }; | |||
278 | )"; | 278 | )"; | ||
279 | 279 | | |||
280 | // NOTE: This fails and needs fixing. If the include of "missing2.h" | 280 | // NOTE: This fails and needs fixing. If the include of "missing2.h" | ||
281 | // above is commented out, then it doesn't fail. Maybe | 281 | // above is commented out, then it doesn't fail. Maybe | ||
282 | // clang stops processing when it encounters the second missing | 282 | // clang stops processing when it encounters the second missing | ||
283 | // header, or similar. | 283 | // header, or similar. | ||
284 | 284 | | |||
285 | TestFile header(code, QStringLiteral("h")); | 285 | TestFile header(code, QStringLiteral("h")); | ||
286 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n", QStringLiteral("cpp"), &header); | 286 | TestFile impl("#include \"" + header.url().str() + "\"\n", QStringLiteral("cpp"), &header); | ||
287 | QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsAndUses)); | 287 | QVERIFY(impl.parseAndWait(TopDUContext::AllDeclarationsContextsAndUses)); | ||
288 | 288 | | |||
289 | DUChainReadLocker lock; | 289 | DUChainReadLocker lock; | ||
290 | 290 | | |||
291 | auto top = impl.topContext(); | 291 | auto top = impl.topContext(); | ||
292 | QVERIFY(top); | 292 | QVERIFY(top); | ||
293 | 293 | | |||
294 | QCOMPARE(top->importedParentContexts().count(), 1); | 294 | QCOMPARE(top->importedParentContexts().count(), 1); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
341 | void TestDUChain::testIncludeLocking() | 341 | void TestDUChain::testIncludeLocking() | ||
342 | { | 342 | { | ||
343 | TestFile header1(createCode("Header1", 1000), QStringLiteral("h")); | 343 | TestFile header1(createCode("Header1", 1000), QStringLiteral("h")); | ||
344 | TestFile header2(createCode("Header2", 1000), QStringLiteral("h")); | 344 | TestFile header2(createCode("Header2", 1000), QStringLiteral("h")); | ||
345 | TestFile header3(createCode("Header3", 1000), QStringLiteral("h")); | 345 | TestFile header3(createCode("Header3", 1000), QStringLiteral("h")); | ||
346 | 346 | | |||
347 | ICore::self()->languageController()->backgroundParser()->setThreadCount(3); | 347 | ICore::self()->languageController()->backgroundParser()->setThreadCount(3); | ||
348 | 348 | | |||
349 | TestFile impl1("#include \"" + header1.url().byteArray() + "\"\n" | 349 | TestFile impl1("#include \"" + header1.url().str() + "\"\n" | ||
350 | "#include \"" + header2.url().byteArray() + "\"\n" | 350 | "#include \"" + header2.url().str() + "\"\n" | ||
351 | "#include \"" + header3.url().byteArray() + "\"\n" | 351 | "#include \"" + header3.url().str() + "\"\n" | ||
352 | "int main() { return 0; }", QStringLiteral("cpp")); | 352 | "int main() { return 0; }", QStringLiteral("cpp")); | ||
353 | 353 | | |||
354 | TestFile impl2("#include \"" + header2.url().byteArray() + "\"\n" | 354 | TestFile impl2("#include \"" + header2.url().str() + "\"\n" | ||
355 | "#include \"" + header1.url().byteArray() + "\"\n" | 355 | "#include \"" + header1.url().str() + "\"\n" | ||
356 | "#include \"" + header3.url().byteArray() + "\"\n" | 356 | "#include \"" + header3.url().str() + "\"\n" | ||
357 | "int main() { return 0; }", QStringLiteral("cpp")); | 357 | "int main() { return 0; }", QStringLiteral("cpp")); | ||
358 | 358 | | |||
359 | TestFile impl3("#include \"" + header3.url().byteArray() + "\"\n" | 359 | TestFile impl3("#include \"" + header3.url().str() + "\"\n" | ||
360 | "#include \"" + header1.url().byteArray() + "\"\n" | 360 | "#include \"" + header1.url().str() + "\"\n" | ||
361 | "#include \"" + header2.url().byteArray() + "\"\n" | 361 | "#include \"" + header2.url().str() + "\"\n" | ||
362 | "int main() { return 0; }", QStringLiteral("cpp")); | 362 | "int main() { return 0; }", QStringLiteral("cpp")); | ||
363 | 363 | | |||
364 | impl1.parse(TopDUContext::AllDeclarationsContextsAndUses); | 364 | impl1.parse(TopDUContext::AllDeclarationsContextsAndUses); | ||
365 | impl2.parse(TopDUContext::AllDeclarationsContextsAndUses); | 365 | impl2.parse(TopDUContext::AllDeclarationsContextsAndUses); | ||
366 | impl3.parse(TopDUContext::AllDeclarationsContextsAndUses); | 366 | impl3.parse(TopDUContext::AllDeclarationsContextsAndUses); | ||
367 | 367 | | |||
368 | QVERIFY(impl1.waitForParsed(5000)); | 368 | QVERIFY(impl1.waitForParsed(5000)); | ||
369 | QVERIFY(impl2.waitForParsed(5000)); | 369 | QVERIFY(impl2.waitForParsed(5000)); | ||
▲ Show 20 Lines • Show All 747 Lines • ▼ Show 20 Line(s) | 1114 | { | |||
1117 | QCOMPARE(ctx->features() & TopDUContext::AllDeclarationsContextsAndUses, static_cast<int>(TopDUContext::AllDeclarationsContextsAndUses)); | 1117 | QCOMPARE(ctx->features() & TopDUContext::AllDeclarationsContextsAndUses, static_cast<int>(TopDUContext::AllDeclarationsContextsAndUses)); | ||
1118 | QVERIFY(ctx->topContext()->ast()); | 1118 | QVERIFY(ctx->topContext()->ast()); | ||
1119 | } | 1119 | } | ||
1120 | } | 1120 | } | ||
1121 | 1121 | | |||
1122 | void TestDUChain::testReparseInclude() | 1122 | void TestDUChain::testReparseInclude() | ||
1123 | { | 1123 | { | ||
1124 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | 1124 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | ||
1125 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n" | 1125 | TestFile impl("#include \"" + header.url().str() + "\"\n" | ||
1126 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | 1126 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | ||
1127 | 1127 | | |||
1128 | // Use TopDUContext::AST to imitate that document is opened in the editor, so that ClangParseJob can store translation unit, that'll be used for reparsing. | 1128 | // Use TopDUContext::AST to imitate that document is opened in the editor, so that ClangParseJob can store translation unit, that'll be used for reparsing. | ||
1129 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsAndContexts|TopDUContext::AST)); | 1129 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsAndContexts|TopDUContext::AST)); | ||
1130 | QVERIFY(impl.waitForParsed(5000)); | 1130 | QVERIFY(impl.waitForParsed(5000)); | ||
1131 | { | 1131 | { | ||
1132 | DUChainReadLocker lock; | 1132 | DUChainReadLocker lock; | ||
1133 | auto implCtx = impl.topContext(); | 1133 | auto implCtx = impl.topContext(); | ||
Show All 28 Lines | |||||
1162 | QCOMPARE(DUChain::self()->allEnvironmentFiles(impl.url()).size(), 1); | 1162 | QCOMPARE(DUChain::self()->allEnvironmentFiles(impl.url()).size(), 1); | ||
1163 | QCOMPARE(DUChain::self()->chainsForDocument(header.url()).size(), 1); | 1163 | QCOMPARE(DUChain::self()->chainsForDocument(header.url()).size(), 1); | ||
1164 | QCOMPARE(DUChain::self()->chainsForDocument(impl.url()).size(), 1); | 1164 | QCOMPARE(DUChain::self()->chainsForDocument(impl.url()).size(), 1); | ||
1165 | } | 1165 | } | ||
1166 | 1166 | | |||
1167 | void TestDUChain::testReparseChangeEnvironment() | 1167 | void TestDUChain::testReparseChangeEnvironment() | ||
1168 | { | 1168 | { | ||
1169 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | 1169 | TestFile header(QStringLiteral("int foo() { return 42; }\n"), QStringLiteral("h")); | ||
1170 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n" | 1170 | TestFile impl("#include \"" + header.url().str() + "\"\n" | ||
1171 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | 1171 | "int main() { return foo(); }", QStringLiteral("cpp"), &header); | ||
1172 | 1172 | | |||
1173 | uint hashes[3] = {0, 0, 0}; | 1173 | uint hashes[3] = {0, 0, 0}; | ||
1174 | 1174 | | |||
1175 | for (int i = 0; i < 3; ++i) { | 1175 | for (int i = 0; i < 3; ++i) { | ||
1176 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | 1176 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | ||
1177 | QVERIFY(impl.waitForParsed(5000)); | 1177 | QVERIFY(impl.waitForParsed(5000)); | ||
1178 | 1178 | | |||
Show All 27 Lines | |||||
1206 | } // 3) stop | 1206 | } // 3) stop | ||
1207 | } | 1207 | } | ||
1208 | } | 1208 | } | ||
1209 | 1209 | | |||
1210 | void TestDUChain::testMacroDependentHeader() | 1210 | void TestDUChain::testMacroDependentHeader() | ||
1211 | { | 1211 | { | ||
1212 | TestFile header(QStringLiteral("struct MY_CLASS { class Q{Q(); int m;}; int m; };\n"), QStringLiteral("h")); | 1212 | TestFile header(QStringLiteral("struct MY_CLASS { class Q{Q(); int m;}; int m; };\n"), QStringLiteral("h")); | ||
1213 | TestFile impl("#define MY_CLASS A\n" | 1213 | TestFile impl("#define MY_CLASS A\n" | ||
1214 | "#include \"" + header.url().byteArray() + "\"\n" | 1214 | "#include \"" + header.url().str() + "\"\n" | ||
1215 | "#undef MY_CLASS\n" | 1215 | "#undef MY_CLASS\n" | ||
1216 | "#define MY_CLASS B\n" | 1216 | "#define MY_CLASS B\n" | ||
1217 | "#include \"" + header.url().byteArray() + "\"\n" | 1217 | "#include \"" + header.url().str() + "\"\n" | ||
1218 | "#undef MY_CLASS\n" | 1218 | "#undef MY_CLASS\n" | ||
1219 | "A a;\n" | 1219 | "A a;\n" | ||
1220 | "const A::Q aq;\n" | 1220 | "const A::Q aq;\n" | ||
1221 | "B b;\n" | 1221 | "B b;\n" | ||
1222 | "const B::Q bq;\n" | 1222 | "const B::Q bq;\n" | ||
1223 | "int am = a.m;\n" | 1223 | "int am = a.m;\n" | ||
1224 | "int aqm = aq.m;\n" | 1224 | "int aqm = aq.m;\n" | ||
1225 | "int bm = b.m;\n" | 1225 | "int bm = b.m;\n" | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
1272 | QCOMPARE(top->uses()[12].usedDeclaration(top)->qualifiedIdentifier(), QualifiedIdentifier("bq")); | 1272 | QCOMPARE(top->uses()[12].usedDeclaration(top)->qualifiedIdentifier(), QualifiedIdentifier("bq")); | ||
1273 | QCOMPARE(top->uses()[13].usedDeclaration(top)->qualifiedIdentifier(), QualifiedIdentifier("B::Q::m")); | 1273 | QCOMPARE(top->uses()[13].usedDeclaration(top)->qualifiedIdentifier(), QualifiedIdentifier("B::Q::m")); | ||
1274 | } | 1274 | } | ||
1275 | 1275 | | |||
1276 | void TestDUChain::testHeaderParsingOrder1() | 1276 | void TestDUChain::testHeaderParsingOrder1() | ||
1277 | { | 1277 | { | ||
1278 | TestFile header(QStringLiteral("typedef const A<int> B;\n"), QStringLiteral("h")); | 1278 | TestFile header(QStringLiteral("typedef const A<int> B;\n"), QStringLiteral("h")); | ||
1279 | TestFile impl("template<class T> class A{};\n" | 1279 | TestFile impl("template<class T> class A{};\n" | ||
1280 | "#include \"" + header.url().byteArray() + "\"\n" | 1280 | "#include \"" + header.url().str() + "\"\n" | ||
1281 | "B c;", QStringLiteral("cpp"), &header); | 1281 | "B c;", QStringLiteral("cpp"), &header); | ||
1282 | 1282 | | |||
1283 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | 1283 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | ||
1284 | QVERIFY(impl.waitForParsed(500000)); | 1284 | QVERIFY(impl.waitForParsed(500000)); | ||
1285 | 1285 | | |||
1286 | DUChainReadLocker lock; | 1286 | DUChainReadLocker lock; | ||
1287 | TopDUContext* top = impl.topContext().data(); | 1287 | TopDUContext* top = impl.topContext().data(); | ||
1288 | QVERIFY(top); | 1288 | QVERIFY(top); | ||
Show All 22 Lines | |||||
1311 | // QVERIFY(decl2); | 1311 | // QVERIFY(decl2); | ||
1312 | // QCOMPARE(decl, decl2); | 1312 | // QCOMPARE(decl, decl2); | ||
1313 | } | 1313 | } | ||
1314 | 1314 | | |||
1315 | void TestDUChain::testHeaderParsingOrder2() | 1315 | void TestDUChain::testHeaderParsingOrder2() | ||
1316 | { | 1316 | { | ||
1317 | TestFile header(QStringLiteral("template<class T> class A{};\n"), QStringLiteral("h")); | 1317 | TestFile header(QStringLiteral("template<class T> class A{};\n"), QStringLiteral("h")); | ||
1318 | TestFile header2(QStringLiteral("typedef const A<int> B;\n"), QStringLiteral("h")); | 1318 | TestFile header2(QStringLiteral("typedef const A<int> B;\n"), QStringLiteral("h")); | ||
1319 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n" | 1319 | TestFile impl("#include \"" + header.url().str() + "\"\n" | ||
1320 | "#include \"" + header2.url().byteArray() + "\"\n" | 1320 | "#include \"" + header2.url().str() + "\"\n" | ||
1321 | "B c;", QStringLiteral("cpp"), &header); | 1321 | "B c;", QStringLiteral("cpp"), &header); | ||
1322 | 1322 | | |||
1323 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | 1323 | impl.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST|TopDUContext::ForceUpdate)); | ||
1324 | QVERIFY(impl.waitForParsed(500000)); | 1324 | QVERIFY(impl.waitForParsed(500000)); | ||
1325 | 1325 | | |||
1326 | DUChainReadLocker lock; | 1326 | DUChainReadLocker lock; | ||
1327 | TopDUContext* top = impl.topContext().data(); | 1327 | TopDUContext* top = impl.topContext().data(); | ||
1328 | QVERIFY(top); | 1328 | QVERIFY(top); | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 1415 | { | |||
1431 | 1431 | | |||
1432 | QCOMPARE(var->uses().size(), 1); | 1432 | QCOMPARE(var->uses().size(), 1); | ||
1433 | QCOMPARE(var->uses().begin()->first(), RangeInRevision(2,11,2,11)); | 1433 | QCOMPARE(var->uses().begin()->first(), RangeInRevision(2,11,2,11)); | ||
1434 | } | 1434 | } | ||
1435 | 1435 | | |||
1436 | void TestDUChain::testNestedImports() | 1436 | void TestDUChain::testNestedImports() | ||
1437 | { | 1437 | { | ||
1438 | TestFile B(QStringLiteral("#pragma once\nint B();\n"), QStringLiteral("h")); | 1438 | TestFile B(QStringLiteral("#pragma once\nint B();\n"), QStringLiteral("h")); | ||
1439 | TestFile C("#pragma once\n#include \"" + B.url().byteArray() + "\"\nint C();\n", QStringLiteral("h")); | 1439 | TestFile C("#pragma once\n#include \"" + B.url().str() + "\"\nint C();\n", QStringLiteral("h")); | ||
1440 | TestFile A("#include \"" + B.url().byteArray() + "\"\n" + "#include \"" + C.url().byteArray() + "\"\nint A();\n", QStringLiteral("cpp")); | 1440 | TestFile A("#include \"" + B.url().str() + "\"\n" + "#include \"" + C.url().str() + "\"\nint A();\n", QStringLiteral("cpp")); | ||
1441 | 1441 | | |||
1442 | A.parse(); | 1442 | A.parse(); | ||
1443 | QVERIFY(A.waitForParsed(5000)); | 1443 | QVERIFY(A.waitForParsed(5000)); | ||
1444 | 1444 | | |||
1445 | DUChainReadLocker lock; | 1445 | DUChainReadLocker lock; | ||
1446 | 1446 | | |||
1447 | auto BCtx = DUChain::self()->chainForDocument(B.url().toUrl()); | 1447 | auto BCtx = DUChain::self()->chainForDocument(B.url().toUrl()); | ||
1448 | QVERIFY(BCtx); | 1448 | QVERIFY(BCtx); | ||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Line(s) | 1624 | #endif | |||
1629 | auto functionDeclaration = DUChainUtils::declarationForDefinition(function.first()); | 1629 | auto functionDeclaration = DUChainUtils::declarationForDefinition(function.first()); | ||
1630 | QVERIFY(!functionDeclaration->isDefinition()); | 1630 | QVERIFY(!functionDeclaration->isDefinition()); | ||
1631 | QCOMPARE(functionDeclaration->uses().count(), 1); | 1631 | QCOMPARE(functionDeclaration->uses().count(), 1); | ||
1632 | } | 1632 | } | ||
1633 | 1633 | | |||
1634 | void TestDUChain::testReparseIncludeGuard() | 1634 | void TestDUChain::testReparseIncludeGuard() | ||
1635 | { | 1635 | { | ||
1636 | TestFile header(QStringLiteral("#ifndef GUARD\n#define GUARD\nint something;\n#endif\n"), QStringLiteral("h")); | 1636 | TestFile header(QStringLiteral("#ifndef GUARD\n#define GUARD\nint something;\n#endif\n"), QStringLiteral("h")); | ||
1637 | TestFile impl("#include \"" + header.url().byteArray() + "\"\n", QStringLiteral("cpp"), &header); | 1637 | TestFile impl("#include \"" + header.url().str() + "\"\n", QStringLiteral("cpp"), &header); | ||
1638 | 1638 | | |||
1639 | QVERIFY(impl.parseAndWait(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::AST ))); | 1639 | QVERIFY(impl.parseAndWait(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::AST ))); | ||
1640 | { | 1640 | { | ||
1641 | DUChainReadLocker lock; | 1641 | DUChainReadLocker lock; | ||
1642 | QCOMPARE(static_cast<TopDUContext*>(impl.topContext()-> | 1642 | QCOMPARE(static_cast<TopDUContext*>(impl.topContext()-> | ||
1643 | importedParentContexts().first().context(impl.topContext()))->problems().size(), 0); | 1643 | importedParentContexts().first().context(impl.topContext()))->problems().size(), 0); | ||
1644 | } | 1644 | } | ||
1645 | QVERIFY(impl.parseAndWait(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::ForceUpdateRecursive))); | 1645 | QVERIFY(impl.parseAndWait(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses | TopDUContext::ForceUpdateRecursive))); | ||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | |||||
1742 | #endif | 1742 | #endif | ||
1743 | QVERIFY(templateAlias->abstractType()); | 1743 | QVERIFY(templateAlias->abstractType()); | ||
1744 | QCOMPARE(templateAlias->abstractType()->toString(), QStringLiteral("TypeAliasTemplate")); | 1744 | QCOMPARE(templateAlias->abstractType()->toString(), QStringLiteral("TypeAliasTemplate")); | ||
1745 | } | 1745 | } | ||
1746 | 1746 | | |||
1747 | void TestDUChain::testDeclarationsInsideMacroExpansion() | 1747 | void TestDUChain::testDeclarationsInsideMacroExpansion() | ||
1748 | { | 1748 | { | ||
1749 | TestFile header(QStringLiteral("#define DECLARE(a) typedef struct a##__ {int var;} *a\nDECLARE(D);\n"), QStringLiteral("h")); | 1749 | TestFile header(QStringLiteral("#define DECLARE(a) typedef struct a##__ {int var;} *a\nDECLARE(D);\n"), QStringLiteral("h")); | ||
1750 | TestFile file("#include \"" + header.url().byteArray() + "\"\nint main(){\nD d; d->var;}\n", QStringLiteral("cpp")); | 1750 | TestFile file("#include \"" + header.url().str() + "\"\nint main(){\nD d; d->var;}\n", QStringLiteral("cpp")); | ||
1751 | 1751 | | |||
1752 | file.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST)); | 1752 | file.parse(TopDUContext::Features(TopDUContext::AllDeclarationsContextsAndUses|TopDUContext::AST)); | ||
1753 | QVERIFY(file.waitForParsed(5000)); | 1753 | QVERIFY(file.waitForParsed(5000)); | ||
1754 | 1754 | | |||
1755 | { | 1755 | { | ||
1756 | DUChainReadLocker lock; | 1756 | DUChainReadLocker lock; | ||
1757 | QVERIFY(file.topContext()); | 1757 | QVERIFY(file.topContext()); | ||
1758 | } | 1758 | } | ||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |