Optimize createSymbolDatabaseExprIds() (#5017)

This commit is contained in:
chrchr-github 2023-04-27 22:06:06 +02:00 committed by GitHub
parent 4fdcb0c784
commit 96cf2b34fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -1626,10 +1626,11 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
// Apply CSE
for (const auto& p:exprs) {
const std::vector<Token*>& tokens = p.second;
for (Token* tok1:tokens) {
for (Token* tok2:tokens) {
if (tok1 == tok2)
continue;
const std::size_t N = tokens.size();
for (std::size_t i = 0; i < N; ++i) {
Token* const tok1 = tokens[i];
for (std::size_t j = i + 1; j < N; ++j) {
Token* const tok2 = tokens[j];
if (tok1->exprId() == tok2->exprId())
continue;
if (!isSameExpression(isCPP(), true, tok1, tok2, mSettings.library, false, false))