From dfa928f599b99b46eeca302a140223eb07eded44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 2 Jun 2024 18:21:16 +0200 Subject: [PATCH] Token: make sure calls are being match compiled (#6480) --- lib/token.cpp | 9 ++++++++- lib/token.h | 7 +------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/token.cpp b/lib/token.cpp index d7b339b6944..fbdf7c5efb9 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -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)); } @@ -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; diff --git a/lib/token.h b/lib/token.h index cd7ab117ba7..9e557376996 100644 --- a/lib/token.h +++ b/lib/token.h @@ -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;