Tokenizer: Create syntax tree before creating symboldatabase

This commit is contained in:
Daniel Marjamäki 2016-05-07 19:56:28 +02:00
parent be90080976
commit ad2d3394c8
1 changed files with 9 additions and 7 deletions

View File

@ -1696,6 +1696,9 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration,
if (simplifyTokenList1(list.getFiles()[0].c_str())) {
if (!noSymbolDB_AST) {
list.createAst();
list.validateAst();
createSymbolDatabase();
// Use symbol database to identify rvalue references. Split && to & &. This is safe, since it doesn't delete any tokens (which might be referenced by symbol database)
@ -1704,14 +1707,13 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration,
if (var && var->isRValueReference()) {
Token* endTok = const_cast<Token*>(var->typeEndToken());
endTok->str("&");
endTok->astOperand1(nullptr);
endTok->astOperand2(nullptr);
endTok->insertToken("&");
endTok->next()->scope(endTok->scope());
}
}
list.createAst();
list.validateAst();
SymbolDatabase::setValueTypeInTokenList(list.front(), isCPP(), _settings->defaultSign, &_settings->library);
ValueFlow::setValues(&list, _symbolDatabase, _errorLogger, _settings);
}
@ -3793,14 +3795,14 @@ bool Tokenizer::simplifyTokenList2()
Token::assignProgressValues(list.front());
// Create symbol database and then remove const keywords
createSymbolDatabase();
simplifyPointerConst();
list.createAst();
// skipping this here may help improve performance. Might be enabled later on demand. #7208
// list.validateAst();
// Create symbol database and then remove const keywords
createSymbolDatabase();
simplifyPointerConst();
ValueFlow::setValues(&list, _symbolDatabase, _errorLogger, _settings);
if (_settings->terminated())