@@ -633,7 +633,7 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList &tokenList, const s
633633 for (const Token *typeToken = tokenList.back (); Token::Match (typeToken, " &|*|%name%" ); typeToken = typeToken->previous ()) {
634634 if (!typeToken->isName ())
635635 continue ;
636- const ::Type *recordType = scope->check -> findVariableType (scope, typeToken);
636+ const ::Type *recordType = scope->symdb . findVariableType (scope, typeToken);
637637 if (recordType) {
638638 const_cast <Token*>(typeToken)->type (recordType);
639639 return recordType;
@@ -702,14 +702,13 @@ Scope *clangimport::AstNode::createScope(TokenList &tokenList, ScopeType scopeTy
702702
703703 auto *nestedIn = const_cast <Scope *>(getNestedInScope (tokenList));
704704
705- symbolDatabase.scopeList .emplace_back (nullptr , nullptr , nestedIn);
705+ symbolDatabase.scopeList .emplace_back (nestedIn-> symdb , nullptr , nestedIn);
706706 Scope *scope = &symbolDatabase.scopeList .back ();
707707 if (scopeType == ScopeType::eEnum)
708708 scope->enumeratorList .reserve (children2.size ());
709709 nestedIn->nestedList .push_back (scope);
710710 scope->type = scopeType;
711- scope->classDef = def;
712- scope->check = nestedIn->check ;
711+ scope->classDef = def; // TODO: pass into ctor
713712 if (Token::Match (def, " if|for|while (" )) {
714713 std::map<const Variable *, const Variable *> replaceVar;
715714 for (const Token *vartok = def->tokAt (2 ); vartok; vartok = vartok->next ()) {
@@ -1404,11 +1403,10 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList &tokenList)
14041403
14051404 Scope *scope = nullptr ;
14061405 if (hasBody) {
1407- symbolDatabase.scopeList .emplace_back (nullptr , nullptr , nestedIn);
1406+ symbolDatabase.scopeList .emplace_back (symbolDatabase , nullptr , nestedIn);
14081407 scope = &symbolDatabase.scopeList .back ();
1409- scope->check = &symbolDatabase;
14101408 scope->function = function;
1411- scope->classDef = nameToken;
1409+ scope->classDef = nameToken; // TODO: pass into ctor
14121410 scope->type = ScopeType::eFunction;
14131411 scope->className = nameToken->str ();
14141412 nestedIn->nestedList .push_back (scope);
@@ -1620,9 +1618,8 @@ void clangimport::parseClangAstDump(Tokenizer &tokenizer, std::istream &f)
16201618
16211619 tokenizer.createSymbolDatabase ();
16221620 auto *symbolDatabase = const_cast <SymbolDatabase *>(tokenizer.getSymbolDatabase ());
1623- symbolDatabase->scopeList .emplace_back (nullptr , nullptr , nullptr );
1621+ symbolDatabase->scopeList .emplace_back (*symbolDatabase , nullptr , nullptr );
16241622 symbolDatabase->scopeList .back ().type = ScopeType::eGlobal;
1625- symbolDatabase->scopeList .back ().check = symbolDatabase;
16261623
16271624 clangimport::Data data (tokenizer.getSettings (), *symbolDatabase);
16281625 std::string line;
0 commit comments