Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review
  • Loading branch information
danmar committed May 6, 2026
commit d301b6a1e44c2bf61485bee80436a6a9b187b36e
40 changes: 20 additions & 20 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,26 @@ static std::string getIncompleteNameID(const Token* tok)
}

namespace {
int getExprIdForOperand(const Token* tok) {
if (!tok)
return 0;

int otherExprId = 0;

// Look through all referenced tokens.
// If two exprIds are found and one matches tok->exprId(), return the other.
// Otherwise, default to returning tok->exprId().
for (const auto& ref: followAllReferences(tok)) {
const int refExprId = ref.token->exprId();
if (refExprId != 0 && refExprId != tok->exprId()) {
if (otherExprId != 0 && otherExprId != refExprId)
return tok->exprId();
otherExprId = refExprId;
}
}
return otherExprId != 0 ? otherExprId : tok->exprId();
}

struct ExprIdKey {
std::string parentOp;
nonneg int operand1;
Expand Down Expand Up @@ -1643,26 +1663,6 @@ namespace {
continue;
}

const auto getExprIdForOperand = [](const Token* tok) -> int {
if (!tok)
return 0;

int otherExprId = 0;

// Look through all referenced tokens.
// If two exprIds are found and one matches tok->exprId(), return the other.
// Otherwise, default to returning tok->exprId().
for (const auto& ref: followAllReferences(tok)) {
const int refExprId = ref.token->exprId();
if (refExprId != 0 && refExprId != tok->exprId()) {
if (otherExprId != 0 && otherExprId != refExprId)
return tok->exprId();
otherExprId = refExprId;
}
}
return otherExprId != 0 ? otherExprId : tok->exprId();
};

ExprIdKey key;
key.parentOp = tok->astParent()->str();
key.operand1 = getExprIdForOperand(op1);
Expand Down
Loading