Skip to content

Commit

Permalink
Token: make sure calls are being match compiled (#6480)
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave authored Jun 2, 2024
1 parent 9526289 commit dfa928f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 8 additions & 1 deletion lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ const Token * Token::findClosingBracket() const
}
// save named template parameter
else if (templateParameter && depth == 1 && Token::Match(closing, "[,=]") &&
closing->previous()->isName() && !Match(closing->previous(), "class|typename|."))
closing->previous()->isName() && !Token::Match(closing->previous(), "class|typename|."))
templateParameters.insert(closing->strAt(-1));
}

Expand Down Expand Up @@ -2330,6 +2330,13 @@ void Token::setValueType(ValueType *vt)
}
}

const ValueType *Token::argumentType() const {
const Token *top = this;
while (top && !Token::Match(top->astParent(), ",|("))
top = top->astParent();
return top ? top->mImpl->mValueType : nullptr;
}

void Token::type(const ::Type *t)
{
mImpl->mType = t;
Expand Down
7 changes: 1 addition & 6 deletions lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,7 @@ class CPPCHECKLIB Token {
}
void setValueType(ValueType *vt);

const ValueType *argumentType() const {
const Token *top = this;
while (top && !Token::Match(top->astParent(), ",|("))
top = top->astParent();
return top ? top->mImpl->mValueType : nullptr;
}
const ValueType *argumentType() const;

Token::Type tokType() const {
return mTokType;
Expand Down

0 comments on commit dfa928f

Please sign in to comment.