Skip to content

Commit

Permalink
Fix getParentValueTypes() for function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Aug 18, 2023
1 parent 8b2a75e commit 2326bc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,10 @@ std::vector<ValueType> getParentValueTypes(const Token* tok, const Settings* set
return {*tok->astParent()->astOperand1()->valueType()};
return {};
}
const Token* ftok{};
if (Token::Match(tok->astParent(), "(|{|,")) {
int argn = -1;
const Token* ftok = getTokenArgumentFunction(tok, argn);
ftok = getTokenArgumentFunction(tok, argn);
const Token* typeTok = nullptr;
if (ftok && argn >= 0) {
if (ftok->function()) {
Expand Down Expand Up @@ -744,7 +745,7 @@ std::vector<ValueType> getParentValueTypes(const Token* tok, const Settings* set
if (Token::Match(tok->astParent(), "return|(|{|%assign%") && parent) {
*parent = tok->astParent();
}
if (tok->astParent()->valueType())
if (!ftok && tok->astParent()->valueType())
return {*tok->astParent()->valueType()};
return {};
}
Expand Down

0 comments on commit 2326bc6

Please sign in to comment.