Skip to content

Commit 96cf2b3

Browse files
Optimize createSymbolDatabaseExprIds() (#5017)
1 parent 4fdcb0c commit 96cf2b3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,10 +1626,11 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
16261626
// Apply CSE
16271627
for (const auto& p:exprs) {
16281628
const std::vector<Token*>& tokens = p.second;
1629-
for (Token* tok1:tokens) {
1630-
for (Token* tok2:tokens) {
1631-
if (tok1 == tok2)
1632-
continue;
1629+
const std::size_t N = tokens.size();
1630+
for (std::size_t i = 0; i < N; ++i) {
1631+
Token* const tok1 = tokens[i];
1632+
for (std::size_t j = i + 1; j < N; ++j) {
1633+
Token* const tok2 = tokens[j];
16331634
if (tok1->exprId() == tok2->exprId())
16341635
continue;
16351636
if (!isSameExpression(isCPP(), true, tok1, tok2, mSettings.library, false, false))

0 commit comments

Comments
 (0)