344
351
void TestDUChain::testContextSearch() {
345
QByteArray method("typedef union { char __size[2]; long int __align; } pthread_attr_t; struct Stru {};");
347
TopDUContext* top = parse(method, DumpNone);
348
DUChainWriteLocker lock(DUChain::lock());
349
QCOMPARE(top->findContexts(DUContext::Class, QualifiedIdentifier("Stru") ).count(), 1);
350
QCOMPARE(top->findContexts(DUContext::Namespace, QualifiedIdentifier("Stru") ).count(), 0);
353
QByteArray method("int t; struct C { }; void test() { C c; c.t = 3;}");
355
TopDUContext* top = parse(method, DumpAll);
356
DUChainWriteLocker lock(DUChain::lock());
357
QCOMPARE(top->localDeclarations().count(), 3);
358
QVERIFY(top->localDeclarations()[0]->uses().isEmpty());
362
QByteArray method("typedef union { char __size[2]; long int __align; } pthread_attr_t; struct Stru {};");
364
TopDUContext* top = parse(method, DumpNone);
365
DUChainWriteLocker lock(DUChain::lock());
366
QCOMPARE(top->findContexts(DUContext::Class, QualifiedIdentifier("Stru") ).count(), 1);
367
QCOMPARE(top->findContexts(DUContext::Namespace, QualifiedIdentifier("Stru") ).count(), 0);
353
372
void TestDUChain::testSeparateVariableDefinition() {
522
541
TEST_FILE_PARSE_ONLY
525
// 012345678901234567890123456789012345678901234567890123456789
526
QByteArray method("class A{ class B {}; }; class C : public A::B { C() : A::B() {} };");
528
TopDUContext* top = parse(method, DumpNone);
530
DUChainWriteLocker lock(DUChain::lock());
532
QCOMPARE(top->localDeclarations().count(), 2);
533
QCOMPARE(top->childContexts().count(), 2);
534
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 1);
535
QCOMPARE(top->childContexts()[1]->usesCount(), 2);
537
QCOMPARE(top->childContexts()[1]->uses()[0].m_range, SimpleRange(0, 41, 0, 42));
538
QCOMPARE(top->childContexts()[1]->uses()[1].m_range, SimpleRange(0, 44, 0, 45));
540
QCOMPARE(top->localDeclarations()[0]->uses().count(), 1);
541
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().count(), 1);
543
QCOMPARE(top->childContexts()[1]->childContexts().count(), 2);
544
QCOMPARE(top->childContexts()[1]->childContexts()[1]->usesCount(), 2);
545
// 012345678901234567890123456789012345678901234567890123456789
546
QByteArray method("namespace N { struct A { A(int); int m; }; }; struct B : public N::A { B() : N::A(5) { this->N::A::m = 5; } };");
548
TopDUContext* top = parse(method, DumpAll);
550
DUChainWriteLocker lock(DUChain::lock());
552
QVERIFY(top->problems().isEmpty()); //N::A must be found in the constructor
553
QCOMPARE(top->childContexts().count(), 2);
554
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 1);
555
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().size(), 1);
556
QCOMPARE(top->childContexts()[0]->childContexts().count(), 1);
557
QCOMPARE(top->childContexts()[0]->childContexts()[0]->localDeclarations().count(), 2);
558
QVERIFY(!top->childContexts()[0]->childContexts()[0]->localDeclarations()[1]->uses().isEmpty());
559
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().begin()->size(), 3);
566
// 012345678901234567890123456789012345678901234567890123456789
567
QByteArray method("class A{ class B {}; }; class C : public A::B { C() : A::B() {} };");
569
TopDUContext* top = parse(method, DumpNone);
571
DUChainWriteLocker lock(DUChain::lock());
573
QCOMPARE(top->localDeclarations().count(), 2);
574
QCOMPARE(top->childContexts().count(), 2);
575
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 1);
576
QCOMPARE(top->childContexts()[1]->usesCount(), 2);
578
QCOMPARE(top->childContexts()[1]->uses()[0].m_range, SimpleRange(0, 41, 0, 42));
579
QCOMPARE(top->childContexts()[1]->uses()[1].m_range, SimpleRange(0, 44, 0, 45));
581
QCOMPARE(top->localDeclarations()[0]->uses().count(), 1);
582
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().count(), 1);
584
QCOMPARE(top->childContexts()[1]->childContexts().count(), 2);
585
QCOMPARE(top->childContexts()[1]->childContexts()[1]->usesCount(), 2);
1062
1125
QVERIFY(top->childContexts()[0]->childContexts()[0]->childContexts()[0]->isPropagateDeclarations());
1063
1126
QVERIFY(!top->childContexts()[0]->childContexts()[0]->childContexts()[0]->localDeclarations()[0]->uses().isEmpty());
1064
1127
QCOMPARE(top->childContexts()[2]->usesCount(), 9);
1129
//Now test Ast mappings
1130
parse(method, DumpNone, top, true);
1131
//!@todo conversions through KSharedPtr
1132
QVERIFY(top->ast().data());
1133
QVERIFY(dynamic_cast<ParseSession *>(top->ast().data()));
1134
ParseSession::Ptr session = ParseSession::Ptr( dynamic_cast<ParseSession *>(top->ast().data()) );
1136
TranslationUnitAST * ast = session->topAstNode();
1138
QCOMPARE(ast->declarations->count(), 3);
1140
//First verify that the node indices correspond to the expected type,
1141
//then test that they correspond to their DUChain mappings
1142
QVERIFY(AstUtils::childNode<SimpleDeclarationAST>(ast, 0));
1143
QCOMPARE(AstUtils::childNode<SimpleDeclarationAST>(ast, 0)->type_specifier,
1144
session->astNodeFromDeclaration(KDevelop::DeclarationPointer(top->localDeclarations()[0])));
1145
QVERIFY(AstUtils::childNode<SimpleDeclarationAST>(ast, 1));
1146
QCOMPARE(AstUtils::childNode<SimpleDeclarationAST>(ast, 1),
1147
session->astNodeFromDeclaration(KDevelop::DeclarationPointer(top->localDeclarations()[1])));
1148
QVERIFY(AstUtils::childNode<FunctionDefinitionAST>(ast, 2));
1149
QCOMPARE(AstUtils::childNode<FunctionDefinitionAST>(ast, 2),
1150
session->astNodeFromDeclaration(KDevelop::DeclarationPointer(top->localDeclarations()[2])) );
1430
1520
Declaration* defRec = classA->localDeclarations()[1];
1431
1521
QVERIFY(defRec->abstractType());
1432
1522
QCOMPARE(defRec->abstractType()->indexed(), defClassA->abstractType()->indexed());
1524
//Test Ast-DuChain mappings
1525
parse(method, DumpAST, top, true);
1527
ParseSession::Ptr session = ParseSession::Ptr(dynamic_cast<ParseSession *>(top->ast().data()));
1528
TranslationUnitAST * ast = session->topAstNode();
1530
ClassSpecifierAST * classAst = AstUtils::node_cast<ClassSpecifierAST>
1531
(AstUtils::childNode<SimpleDeclarationAST>(ast, 0)->type_specifier);
1533
kDebug() << "count:" << classAst->member_specs->count();
1534
QCOMPARE(session->declarationFromAstNode( AstUtils::childNode<SimpleDeclarationAST>(ast, 0)->type_specifier ),
1535
KDevelop::DeclarationPointer(top->localDeclarations()[0]));
1536
QCOMPARE(session->declarationFromAstNode( AstUtils::childNode<FunctionDefinitionAST>(classAst, 0) ),
1537
KDevelop::DeclarationPointer(top->childContexts()[0]->localDeclarations()[0]));
1539
//I haven't figured out why the AST inserts a NULL node after A's constructor
1540
QCOMPARE(session->declarationFromAstNode( AstUtils::childNode<SimpleDeclarationAST>(classAst, 2) ),
1541
KDevelop::DeclarationPointer(top->childContexts()[0]->localDeclarations()[1]));
1542
QCOMPARE(session->declarationFromAstNode( AstUtils::childNode<SimpleDeclarationAST>(classAst, 3) ),
1543
KDevelop::DeclarationPointer(top->childContexts()[0]->localDeclarations()[2]));
3014
void TestDUChain::testSourceCodeInsertion()
3017
QByteArray method("namespace A {\nclass B {};\n}\n");
3019
TopDUContext* top = parse(method, DumpNone);
3021
DUChainWriteLocker lock(DUChain::lock());
3022
InsertArtificialCodeRepresentation repr(top->url(), QString::fromUtf8(method));
3024
QCOMPARE(top->childContexts().count(), 1);
3025
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 1);
3027
QCOMPARE(repr.text().trimmed().split('\n').count(), 3);
3029
Cpp::SourceCodeInsertion ins(top);
3030
ins.insertForwardDeclaration(top->childContexts()[0]->localDeclarations()[0]);
3031
DocumentChangeSet::ChangeResult result = ins.changes().applyAllChanges(KDevelop::DocumentChangeSet::StopOnFailedChange);
3033
kDebug() << repr.text();
3034
// QVERIFY(repr.text().trimmed().remove(' ').remove('\n').contains(QString("int testVar;").remove(' ')));
3036
//Only one newline should be added
3037
QCOMPARE(repr.text().trimmed().split('\n').count(), 4);
3040
top = parse(repr.text().toUtf8(), DumpNone, top);
3042
QCOMPARE(top->childContexts().count(), 1);
3043
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 2);
3049
QByteArray method("");
3051
TopDUContext* top = parse(method, DumpNone);
3053
DUChainWriteLocker lock(DUChain::lock());
3054
InsertArtificialCodeRepresentation repr(top->url(), QString::fromUtf8(method));
3057
Cpp::SourceCodeInsertion ins(top);
3058
ins.insertFunctionDeclaration(Identifier("test"), AbstractType::Ptr(new IntegralType(IntegralType::TypeVoid)), QList<Cpp::SourceCodeInsertion::SignatureItem>(), false, "{ this is the body; }");
3059
DocumentChangeSet::ChangeResult result = ins.changes().applyAllChanges(KDevelop::DocumentChangeSet::StopOnFailedChange);
3060
kDebug() << result.m_failureReason;
3062
kDebug() << repr.text();
3063
QVERIFY(repr.text().trimmed().remove(' ').remove('\n').contains(QString("void test() { this is the body; }").remove(' ')));
3065
//Only one newline should be added
3066
QCOMPARE(repr.text().split('\n').count(), 2);
3069
top = parse(repr.text().toUtf8(), DumpNone, top);
3071
QCOMPARE(top->localDeclarations().count(), 1);
3074
Cpp::SourceCodeInsertion ins(top);
3075
ins.insertVariableDeclaration(Identifier("testVar"), AbstractType::Ptr(new IntegralType(IntegralType::TypeInt)));
3076
DocumentChangeSet::ChangeResult result = ins.changes().applyAllChanges(KDevelop::DocumentChangeSet::StopOnFailedChange);
3078
kDebug() << repr.text();
3079
QVERIFY(repr.text().trimmed().remove(' ').remove('\n').contains(QString("int testVar;").remove(' ')));
3081
//Only one newline should be added
3082
QCOMPARE(repr.text().split('\n').count(), 3);
3085
top = parse(repr.text().toUtf8(), DumpNone, top);
3087
QCOMPARE(top->localDeclarations().count(), 2);
3088
QCOMPARE(top->localDeclarations()[0]->identifier(), Identifier("test"));
3089
QCOMPARE(top->localDeclarations()[1]->identifier(), Identifier("testVar"));
3092
Cpp::SourceCodeInsertion ins(top);
3093
ins.setInsertBefore(top->localDeclarations()[1]->range().start);
3094
ins.insertForwardDeclaration(top->localDeclarations()[1]);
3095
DocumentChangeSet::ChangeResult result = ins.changes().applyAllChanges(KDevelop::DocumentChangeSet::StopOnFailedChange);
3097
kDebug() << repr.text();
3098
// QVERIFY(repr.text().trimmed().remove(' ').remove('\n').contains(QString("int testVar;").remove(' ')));
3100
//Only one newline should be added
3101
QCOMPARE(repr.text().trimmed().split('\n').count(), 3);
3104
top = parse(repr.text().toUtf8(), DumpNone, top);
3106
QCOMPARE(top->localDeclarations().count(), 3);
3107
///@todo Wrong order (Minor issue when updating without smart-ranges)
3108
QCOMPARE(top->localDeclarations()[0]->identifier(), Identifier("test"));
3109
QCOMPARE(top->localDeclarations()[1]->identifier(), Identifier("testVar"));
3110
QCOMPARE(top->localDeclarations()[2]->identifier(), Identifier("testVar"));
3116
void TestDUChain::testSimplifiedTypeString()
3119
QByteArray method("template<class T> class Template { class Member; Member mem; }; Template< Template< int >* >::Member q;\n");
3121
TopDUContext* top = parse(method, DumpNone);
3123
InsertArtificialCodeRepresentation repr(top->url(), QString::fromUtf8(method));
3125
DUChainWriteLocker lock(DUChain::lock());
3126
QCOMPARE(top->localDeclarations().count(), 2);
3128
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[1]->abstractType(), top).remove(' '), QString("Template<Template<int>*>::Member").remove(' '));
3132
///@todo Add more tests for this
3133
QByteArray method("template<typename T> struct F; template<class T> class Tc; Tc<const F<int*>*> t; const Tc<const F<int*>*>**const*& Test1; Tc<F<int*>*>* test();\n");
3135
TopDUContext* top = parse(method, DumpNone);
3137
InsertArtificialCodeRepresentation repr(top->url(), QString::fromUtf8(method));
3139
DUChainWriteLocker lock(DUChain::lock());
3140
QCOMPARE(top->localDeclarations().count(), 5);
3141
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[2]->abstractType(), top).remove(' '), QString("Tc<const F<int*>*>").remove(' '));
3142
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[3]->abstractType(), top).remove(' '), QString("constTc<const F<int*>*>**const*&").remove(' '));
3143
FunctionType::Ptr funType = top->localDeclarations()[4]->abstractType().cast<FunctionType>();
3145
QVERIFY(funType->returnType());
3147
//For loop is needed to test the updating, as there was a problem with that
3148
for(int a = 0; a < 3; ++a) {
3149
kDebug() << "run" << a;
3151
parse(method, DumpNone, top);
3153
repr.setText(QString::fromUtf8(method));
3154
Cpp::SourceCodeInsertion ins(top);
3155
ins.insertFunctionDeclaration(Identifier("test"), funType->returnType(), QList<Cpp::SourceCodeInsertion::SignatureItem>(), false, "{ this is the body; }");
3156
DocumentChangeSet::ChangeResult result = ins.changes().applyAllChanges(KDevelop::DocumentChangeSet::StopOnFailedChange);
3157
kDebug() << result.m_failureReason;
3159
kDebug() << repr.text();
3160
QVERIFY(repr.text().trimmed().remove(' ').remove('\n').contains(QString("Tc< F< int* >* >* test() { this is the body; }").remove(' ')));
3162
parse(repr.text().toUtf8(), DumpNone, top);
3164
QVERIFY(top->localDeclarations().count() == 6);
3166
FunctionType::Ptr funType2 = top->localDeclarations()[5]->abstractType().cast<FunctionType>();
3168
QVERIFY(funType2->returnType());
3169
QVERIFY(funType2->returnType()->equals(funType->returnType().unsafeData()));
3170
QCOMPARE(Cpp::simplifiedTypeString(funType2->returnType(), top).remove(' '), QString("Tc< F< int* >* >*").remove(' '));
2909
3177
void TestDUChain::testTemplateReference() {
2910
3178
QByteArray method("class A; template<class T> class CC; void test(CC<const A*>& item); const A& a;const A*** b;CC<const A> cca;");
2920
3188
QVERIFY(argType.cast<ReferenceType>());
2921
3189
QCOMPARE(argType->toString().remove(' '), QString("CC<constA*>&"));
2923
/* QWidget* navigationWidget = top->childContexts()[1]->createNavigationWidget(top->childContexts()[1]->localDeclarations()[0]);
2924
QVERIFY(navigationWidget);
2925
KDevelop::AbstractNavigationWidget* nWidget = dynamic_cast<KDevelop::AbstractNavigationWidget*>(navigationWidget);
2927
QVERIFY(nWidget->context());
2928
QString html = nWidget->context()->html();
2929
kDebug() << "html:" << html;*/
3191
// QWidget* navigationWidget = top->childContexts()[1]->createNavigationWidget(top->childContexts()[1]->localDeclarations()[0]);
3192
// QVERIFY(navigationWidget);
3193
// KDevelop::AbstractNavigationWidget* nWidget = dynamic_cast<KDevelop::AbstractNavigationWidget*>(navigationWidget);
3194
// QVERIFY(nWidget);
3195
// QVERIFY(nWidget->context());
3196
// QString html = nWidget->context()->html();
3197
// kDebug() << "html:" << html;
2931
QCOMPARE(Cpp::shortenedTypeString(top->childContexts()[1]->localDeclarations()[0], top, 10000).remove(' '), QString("CC<constA*>&"));
3199
QCOMPARE(Cpp::simplifiedTypeString(top->childContexts()[1]->localDeclarations()[0]->abstractType(), top).remove(' '), QString("CC<constA*>&"));
2932
3200
QVERIFY(top->localDeclarations()[3]->abstractType());
2933
QCOMPARE(Cpp::shortenedTypeString(top->localDeclarations()[3], top, 10000).remove(' '), QString("constA&"));
2934
QCOMPARE(Cpp::shortenedTypeString(top->localDeclarations()[4], top, 10000).remove(' '), QString("constA***"));
3201
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[3]->abstractType(), top).remove(' '), QString("constA&"));
3202
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[4]->abstractType(), top).remove(' '), QString("constA***"));
2935
3203
AbstractType::Ptr type = top->localDeclarations()[5]->abstractType();
2937
3205
QCOMPARE(type->toString().remove(' '), QString("CC<constA>"));
2938
QCOMPARE(Cpp::shortenedTypeString(top->localDeclarations()[5], top, 10000).remove(' '), QString("CC<constA>"));
3206
QCOMPARE(Cpp::simplifiedTypeString(top->localDeclarations()[5]->abstractType(), top).remove(' '), QString("CC<constA>"));
2941
3210
void TestDUChain::testTemplates() {
3431
void TestDUChain::testTemplates4()
3434
QByteArray method("template<class A> class Temp { typedef A Mem; }; class B {class A { typedef int AMember; }; }; ");
3436
TopDUContext* top = parse(method, DumpNone);
3438
DUChainWriteLocker lock(DUChain::lock());
3439
QCOMPARE(top->childContexts().count(), 3);
3440
Declaration* memDecl = findDeclaration(top->childContexts()[2], QualifiedIdentifier("Temp<A>::Mem"));;
3442
QCOMPARE(unAliasedType(memDecl->abstractType())->toString(), QString("B::A"));
3443
QVERIFY(findDeclaration(top->childContexts()[2], QualifiedIdentifier("Temp<A>::Mem::AMember")));
3448
QByteArray method("template<class T> struct Cnt { typedef T Val; }; struct Item; template<class Value> struct Freqto { struct Item { typedef Value Value2; }; struct Pattern : public Cnt<Item> { }; };");
3450
TopDUContext* top = parse(method, DumpNone);
3451
DUChainWriteLocker lock(DUChain::lock());
3452
QCOMPARE(top->childContexts().count(), 4);
3453
QCOMPARE(top->childContexts()[3]->childContexts().count(), 2);
3455
//The import should have been delayed, since it needs 'Item'
3456
QVERIFY(top->childContexts()[3]->childContexts()[1]->owner());
3457
ClassDeclaration* classDecl = dynamic_cast<ClassDeclaration*>(top->childContexts()[3]->childContexts()[1]->owner());
3459
QCOMPARE(classDecl->baseClassesSize(), 1u);
3460
QVERIFY(top->childContexts()[3]->childContexts()[1]->importedParentContexts().isEmpty());
3461
QVERIFY(classDecl->baseClasses()[0].baseClass.type<DelayedType>());
3462
kDebug() << classDecl->baseClasses()[0].baseClass.abstractType()->toString();
3463
Declaration* val2Decl = findDeclaration(top, QualifiedIdentifier("Freqto<int>::Pattern::Val::Value2"));
3465
QCOMPARE(unAliasedType(val2Decl->abstractType())->toString(), QString("int"));
3162
3471
void TestDUChain::testTemplates2() {
3163
3472
QByteArray method("struct S {} ; template<class TT> class Base { struct Alloc { typedef TT& referenceType; }; }; template<class T> struct Class : public Base<T> { typedef typename Base<T>::Alloc Alloc; typedef typename Alloc::referenceType reference; reference member; }; Class<S*&> instance;");
3165
TopDUContext* top = parse(method, DumpAll);
3474
TopDUContext* top = parse(method, DumpNone);
3167
3476
DUChainWriteLocker lock(DUChain::lock());
3725
void TestDUChain::testOperatorUses()
3728
QByteArray method("struct S { bool operator() () const {} };void test() { S s; s(); S()(); } ");
3730
TopDUContext* top = parse(method, DumpAll);
3732
DUChainWriteLocker lock(DUChain::lock());
3733
QCOMPARE(top->localDeclarations().count(), 2);
3734
QCOMPARE(top->localDeclarations()[0]->uses().size(), 1);
3735
QCOMPARE(top->localDeclarations()[0]->uses().begin()->size(), 2);
3736
QCOMPARE(top->childContexts().count(), 3);
3737
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 1);
3738
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().size(), 1);
3739
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().begin()->size(), 2);
3744
QByteArray method("struct S { S operator() () const {}; S(int) {}; };void test() { S s(1); s(); S(1)()(); } ");
3746
TopDUContext* top = parse(method, DumpAll);
3748
DUChainWriteLocker lock(DUChain::lock());
3749
QCOMPARE(top->localDeclarations().count(), 2);
3750
QCOMPARE(top->localDeclarations()[0]->uses().size(), 1);
3751
QCOMPARE(top->localDeclarations()[0]->uses().begin()->size(), 3);
3752
QCOMPARE(top->childContexts().count(), 3);
3753
QCOMPARE(top->childContexts()[0]->localDeclarations().count(), 2);
3754
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().size(), 1);
3755
QCOMPARE(top->childContexts()[0]->localDeclarations()[0]->uses().begin()->size(), 3);
3756
QCOMPARE(top->childContexts()[0]->localDeclarations()[1]->uses().size(), 1);
3757
///@todo Also build constructor-uses for initializers
3758
QCOMPARE(top->childContexts()[0]->localDeclarations()[1]->uses().begin()->size(), 1);
3759
// QCOMPARE(top->childContexts()[0]->localDeclarations()[1]->uses().begin()->at(0).textRange(), KTextEditor::Range(0, 68, 0, 69));
3760
QCOMPARE(top->childContexts()[0]->localDeclarations()[1]->uses().begin()->at(0).textRange(), KTextEditor::Range(0, 79, 0, 80));
3415
3766
struct TestContext {
3416
3767
TestContext() {
3417
3768
static int number = 0;
4329
4681
session->setContentsAndGenerateLocationTable(pp.processFile("anonymous", unit));
4331
4683
Parser parser(&control);
4332
TranslationUnitAST* ast = parser.parse(session);
4333
ast->session = session;
4684
TranslationUnitAST* ast = parser.parse(session.data());
4685
ast->session = session.data();
4335
4687
if (dump & DumpAST) {
4336
4688
kDebug(9007) << "===== AST:";
4337
cppDumper.dump(ast, session);
4689
cppDumper.dump(ast, session.data());
4340
4692
static int testNumber = 0;
4341
4693
IndexedString url(QString("/internal/%1").arg(testNumber++));
4343
DeclarationBuilder definitionBuilder(session);
4695
DeclarationBuilder definitionBuilder(session.data());
4344
4696
Cpp::EnvironmentFilePointer file( new Cpp::EnvironmentFile( url, 0 ) );
4698
//HACK Should actually use DUChain::updateContextForUrl
4699
kDebug() << "update->features & TopDUContext::AST: " << (update ? update->features() & TopDUContext::AST : 0);
4702
definitionBuilder.setMapAst(true);
4703
update->setAst( IAstContainer::Ptr( session.data() ) );
4345
4705
TopDUContext* top = definitionBuilder.buildDeclarations(file, ast, 0, ReferencedTopDUContext(update));
4347
4707
Q_ASSERT(top == update);
4350
UseBuilder useBuilder(session);
4710
UseBuilder useBuilder(session.data());
4351
4711
useBuilder.buildUses(ast);
4353
4713
if (dump & DumpDUChain) {