Token: Improved const correctness of findsimplematch() and findmatch(). There are no functional changes.
This commit is contained in:
parent
e76710c906
commit
960a0c6b11
|
@ -843,7 +843,7 @@ Token * Token::findClosingBracket()
|
|||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const Token *Token::findsimplematch(const Token *startTok, const char pattern[])
|
||||
const Token *Token::findsimplematch(const Token * const startTok, const char pattern[])
|
||||
{
|
||||
for (const Token* tok = startTok; tok; tok = tok->next()) {
|
||||
if (Token::simpleMatch(tok, pattern))
|
||||
|
@ -852,7 +852,7 @@ const Token *Token::findsimplematch(const Token *startTok, const char pattern[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
const Token *Token::findsimplematch(const Token *startTok, const char pattern[], const Token *end)
|
||||
const Token *Token::findsimplematch(const Token * const startTok, const char pattern[], const Token * const end)
|
||||
{
|
||||
for (const Token* tok = startTok; tok && tok != end; tok = tok->next()) {
|
||||
if (Token::simpleMatch(tok, pattern))
|
||||
|
@ -861,7 +861,7 @@ const Token *Token::findsimplematch(const Token *startTok, const char pattern[],
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Token *Token::findmatch(const Token *startTok, const char pattern[], unsigned int varId)
|
||||
const Token *Token::findmatch(const Token * const startTok, const char pattern[], const unsigned int varId)
|
||||
{
|
||||
for (const Token* tok = startTok; tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, pattern, varId))
|
||||
|
@ -870,7 +870,7 @@ const Token *Token::findmatch(const Token *startTok, const char pattern[], unsig
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Token *Token::findmatch(const Token *startTok, const char pattern[], const Token *end, unsigned int varId)
|
||||
const Token *Token::findmatch(const Token * const startTok, const char pattern[], const Token * const end, const unsigned int varId)
|
||||
{
|
||||
for (const Token* tok = startTok; tok && tok != end; tok = tok->next()) {
|
||||
if (Token::Match(tok, pattern, varId))
|
||||
|
|
16
lib/token.h
16
lib/token.h
|
@ -411,20 +411,20 @@ public:
|
|||
setFlag(fIsEnumType, value);
|
||||
}
|
||||
|
||||
static const Token *findsimplematch(const Token *startTok, const char pattern[]);
|
||||
static const Token *findsimplematch(const Token *startTok, const char pattern[], const Token *end);
|
||||
static const Token *findmatch(const Token *startTok, const char pattern[], unsigned int varId = 0);
|
||||
static const Token *findmatch(const Token *startTok, const char pattern[], const Token *end, unsigned int varId = 0);
|
||||
static Token *findsimplematch(Token *startTok, const char pattern[]) {
|
||||
static const Token *findsimplematch(const Token * const startTok, const char pattern[]);
|
||||
static const Token *findsimplematch(const Token * const startTok, const char pattern[], const Token * const end);
|
||||
static const Token *findmatch(const Token * const startTok, const char pattern[], const unsigned int varId = 0U);
|
||||
static const Token *findmatch(const Token * const startTok, const char pattern[], const Token * const end, const unsigned int varId = 0U);
|
||||
static Token *findsimplematch(Token * const startTok, const char pattern[]) {
|
||||
return const_cast<Token *>(findsimplematch(const_cast<const Token *>(startTok), pattern));
|
||||
}
|
||||
static Token *findsimplematch(Token *startTok, const char pattern[], const Token *end) {
|
||||
static Token *findsimplematch(Token * const startTok, const char pattern[], const Token * const end) {
|
||||
return const_cast<Token *>(findsimplematch(const_cast<const Token *>(startTok), pattern, end));
|
||||
}
|
||||
static Token *findmatch(Token *startTok, const char pattern[], unsigned int varId = 0) {
|
||||
static Token *findmatch(Token * const startTok, const char pattern[], const unsigned int varId = 0U) {
|
||||
return const_cast<Token *>(findmatch(const_cast<const Token *>(startTok), pattern, varId));
|
||||
}
|
||||
static Token *findmatch(Token *startTok, const char pattern[], const Token *end, unsigned int varId = 0) {
|
||||
static Token *findmatch(Token * const startTok, const char pattern[], const Token * const end, const unsigned int varId = 0U) {
|
||||
return const_cast<Token *>(findmatch(const_cast<const Token *>(startTok), pattern, end, varId));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue