@@ -658,14 +658,13 @@ Scope *clangimport::AstNode::createScope(TokenList &tokenList, Scope::ScopeType
658
658
659
659
auto *nestedIn = const_cast <Scope *>(getNestedInScope (tokenList));
660
660
661
- symbolDatabase->scopeList .emplace_back (nullptr , nullptr , nestedIn);
661
+ symbolDatabase->scopeList .emplace_back (nestedIn-> symdb , nullptr , nestedIn);
662
662
Scope *scope = &symbolDatabase->scopeList .back ();
663
663
if (scopeType == Scope::ScopeType::eEnum)
664
664
scope->enumeratorList .reserve (children2.size ());
665
665
nestedIn->nestedList .push_back (scope);
666
666
scope->type = scopeType;
667
- scope->classDef = def;
668
- scope->symdb = nestedIn->symdb ;
667
+ scope->classDef = def; // TODO: pass into ctor
669
668
if (Token::Match (def, " if|for|while (" )) {
670
669
std::map<const Variable *, const Variable *> replaceVar;
671
670
for (const Token *vartok = def->tokAt (2 ); vartok; vartok = vartok->next ()) {
@@ -1361,11 +1360,10 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList &tokenList)
1361
1360
1362
1361
Scope *scope = nullptr ;
1363
1362
if (hasBody) {
1364
- symbolDatabase->scopeList .emplace_back (nullptr , nullptr , nestedIn);
1363
+ symbolDatabase->scopeList .emplace_back (symbolDatabase , nullptr , nestedIn);
1365
1364
scope = &symbolDatabase->scopeList .back ();
1366
- scope->symdb = symbolDatabase;
1367
1365
scope->function = function;
1368
- scope->classDef = nameToken;
1366
+ scope->classDef = nameToken; // TODO: pass into ctor
1369
1367
scope->type = Scope::ScopeType::eFunction;
1370
1368
scope->className = nameToken->str ();
1371
1369
nestedIn->nestedList .push_back (scope);
@@ -1577,9 +1575,8 @@ void clangimport::parseClangAstDump(Tokenizer &tokenizer, std::istream &f)
1577
1575
1578
1576
tokenizer.createSymbolDatabase ();
1579
1577
auto *symbolDatabase = const_cast <SymbolDatabase *>(tokenizer.getSymbolDatabase ());
1580
- symbolDatabase->scopeList .emplace_back (nullptr , nullptr , nullptr );
1578
+ symbolDatabase->scopeList .emplace_back (symbolDatabase , nullptr , nullptr );
1581
1579
symbolDatabase->scopeList .back ().type = Scope::ScopeType::eGlobal;
1582
- symbolDatabase->scopeList .back ().symdb = symbolDatabase;
1583
1580
1584
1581
clangimport::Data data;
1585
1582
data.mSettings = &tokenizer.getSettings ();
0 commit comments