@@ -633,7 +633,7 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList &tokenList, const s
633
633
for (const Token *typeToken = tokenList.back (); Token::Match (typeToken, " &|*|%name%" ); typeToken = typeToken->previous ()) {
634
634
if (!typeToken->isName ())
635
635
continue ;
636
- const ::Type *recordType = scope->check -> findVariableType (scope, typeToken);
636
+ const ::Type *recordType = scope->symdb . findVariableType (scope, typeToken);
637
637
if (recordType) {
638
638
const_cast <Token*>(typeToken)->type (recordType);
639
639
return recordType;
@@ -702,14 +702,13 @@ Scope *clangimport::AstNode::createScope(TokenList &tokenList, ScopeType scopeTy
702
702
703
703
auto *nestedIn = const_cast <Scope *>(getNestedInScope (tokenList));
704
704
705
- symbolDatabase.scopeList .emplace_back (nullptr , nullptr , nestedIn);
705
+ symbolDatabase.scopeList .emplace_back (nestedIn-> symdb , nullptr , nestedIn);
706
706
Scope *scope = &symbolDatabase.scopeList .back ();
707
707
if (scopeType == ScopeType::eEnum)
708
708
scope->enumeratorList .reserve (children2.size ());
709
709
nestedIn->nestedList .push_back (scope);
710
710
scope->type = scopeType;
711
- scope->classDef = def;
712
- scope->check = nestedIn->check ;
711
+ scope->classDef = def; // TODO: pass into ctor
713
712
if (Token::Match (def, " if|for|while (" )) {
714
713
std::map<const Variable *, const Variable *> replaceVar;
715
714
for (const Token *vartok = def->tokAt (2 ); vartok; vartok = vartok->next ()) {
@@ -1404,11 +1403,10 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList &tokenList)
1404
1403
1405
1404
Scope *scope = nullptr ;
1406
1405
if (hasBody) {
1407
- symbolDatabase.scopeList .emplace_back (nullptr , nullptr , nestedIn);
1406
+ symbolDatabase.scopeList .emplace_back (symbolDatabase , nullptr , nestedIn);
1408
1407
scope = &symbolDatabase.scopeList .back ();
1409
- scope->check = &symbolDatabase;
1410
1408
scope->function = function;
1411
- scope->classDef = nameToken;
1409
+ scope->classDef = nameToken; // TODO: pass into ctor
1412
1410
scope->type = ScopeType::eFunction;
1413
1411
scope->className = nameToken->str ();
1414
1412
nestedIn->nestedList .push_back (scope);
@@ -1620,9 +1618,8 @@ void clangimport::parseClangAstDump(Tokenizer &tokenizer, std::istream &f)
1620
1618
1621
1619
tokenizer.createSymbolDatabase ();
1622
1620
auto *symbolDatabase = const_cast <SymbolDatabase *>(tokenizer.getSymbolDatabase ());
1623
- symbolDatabase->scopeList .emplace_back (nullptr , nullptr , nullptr );
1621
+ symbolDatabase->scopeList .emplace_back (*symbolDatabase , nullptr , nullptr );
1624
1622
symbolDatabase->scopeList .back ().type = ScopeType::eGlobal;
1625
- symbolDatabase->scopeList .back ().check = symbolDatabase;
1626
1623
1627
1624
clangimport::Data data (tokenizer.getSettings (), *symbolDatabase);
1628
1625
std::string line;
0 commit comments