renamed _tokensFrontBack to mTokensFrontBack
This commit is contained in:
parent
26d58ddbb9
commit
cc521bef99
|
@ -36,7 +36,7 @@
|
|||
const std::list<ValueFlow::Value> Token::emptyValueList;
|
||||
|
||||
Token::Token(TokensFrontBack *tokensFrontBack) :
|
||||
_tokensFrontBack(tokensFrontBack),
|
||||
mTokensFrontBack(tokensFrontBack),
|
||||
mNext(nullptr),
|
||||
mPrevious(nullptr),
|
||||
_link(nullptr),
|
||||
|
@ -219,8 +219,8 @@ void Token::deleteNext(unsigned long index)
|
|||
|
||||
if (mNext)
|
||||
mNext->previous(this);
|
||||
else if (_tokensFrontBack)
|
||||
_tokensFrontBack->back = this;
|
||||
else if (mTokensFrontBack)
|
||||
mTokensFrontBack->back = this;
|
||||
}
|
||||
|
||||
void Token::deletePrevious(unsigned long index)
|
||||
|
@ -239,8 +239,8 @@ void Token::deletePrevious(unsigned long index)
|
|||
|
||||
if (mPrevious)
|
||||
mPrevious->next(this);
|
||||
else if (_tokensFrontBack)
|
||||
_tokensFrontBack->front = this;
|
||||
else if (mTokensFrontBack)
|
||||
mTokensFrontBack->front = this;
|
||||
}
|
||||
|
||||
void Token::swapWithNext()
|
||||
|
@ -332,10 +332,10 @@ void Token::replace(Token *replaceThis, Token *start, Token *end)
|
|||
start->previous(replaceThis->previous());
|
||||
end->next(replaceThis->next());
|
||||
|
||||
if (end->_tokensFrontBack && end->_tokensFrontBack->back == end) {
|
||||
if (end->mTokensFrontBack && end->mTokensFrontBack->back == end) {
|
||||
while (end->next())
|
||||
end = end->next();
|
||||
end->_tokensFrontBack->back = end;
|
||||
end->mTokensFrontBack->back = end;
|
||||
}
|
||||
|
||||
// Update _progressValue, fileIndex and linenr
|
||||
|
@ -926,7 +926,7 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
|
|||
if (_str.empty())
|
||||
newToken = this;
|
||||
else
|
||||
newToken = new Token(_tokensFrontBack);
|
||||
newToken = new Token(mTokensFrontBack);
|
||||
newToken->str(tokenStr);
|
||||
if (!originalNameStr.empty())
|
||||
newToken->originalName(originalNameStr);
|
||||
|
@ -949,8 +949,8 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
|
|||
if (this->next()) {
|
||||
newToken->next(this->next());
|
||||
newToken->next()->previous(newToken);
|
||||
} else if (_tokensFrontBack) {
|
||||
_tokensFrontBack->back = newToken;
|
||||
} else if (mTokensFrontBack) {
|
||||
mTokensFrontBack->back = newToken;
|
||||
}
|
||||
this->next(newToken);
|
||||
newToken->previous(this);
|
||||
|
|
|
@ -62,7 +62,7 @@ struct TokensFrontBack {
|
|||
*/
|
||||
class CPPCHECKLIB Token {
|
||||
private:
|
||||
TokensFrontBack* _tokensFrontBack;
|
||||
TokensFrontBack* mTokensFrontBack;
|
||||
|
||||
// Not implemented..
|
||||
Token(const Token &);
|
||||
|
|
|
@ -38,7 +38,7 @@ static const unsigned int AST_MAX_DEPTH = 50U;
|
|||
|
||||
|
||||
TokenList::TokenList(const Settings* settings) :
|
||||
_tokensFrontBack(),
|
||||
mTokensFrontBack(),
|
||||
mSettings(settings),
|
||||
_isC(false),
|
||||
_isCPP(false)
|
||||
|
@ -65,9 +65,9 @@ const std::string& TokenList::getSourceFilePath() const
|
|||
// Deallocate lists..
|
||||
void TokenList::deallocateTokens()
|
||||
{
|
||||
deleteTokens(_tokensFrontBack.front);
|
||||
_tokensFrontBack.front = nullptr;
|
||||
_tokensFrontBack.back = nullptr;
|
||||
deleteTokens(mTokensFrontBack.front);
|
||||
mTokensFrontBack.front = nullptr;
|
||||
mTokensFrontBack.back = nullptr;
|
||||
_files.clear();
|
||||
}
|
||||
|
||||
|
@ -141,18 +141,18 @@ void TokenList::addtoken(std::string str, const unsigned int lineno, const unsig
|
|||
str = MathLib::value(str).str() + suffix;
|
||||
}
|
||||
|
||||
if (_tokensFrontBack.back) {
|
||||
_tokensFrontBack.back->insertToken(str);
|
||||
if (mTokensFrontBack.back) {
|
||||
mTokensFrontBack.back->insertToken(str);
|
||||
} else {
|
||||
_tokensFrontBack.front = new Token(&_tokensFrontBack);
|
||||
_tokensFrontBack.back = _tokensFrontBack.front;
|
||||
_tokensFrontBack.back->str(str);
|
||||
mTokensFrontBack.front = new Token(&mTokensFrontBack);
|
||||
mTokensFrontBack.back = mTokensFrontBack.front;
|
||||
mTokensFrontBack.back->str(str);
|
||||
}
|
||||
|
||||
if (isCPP() && str == "delete")
|
||||
_tokensFrontBack.back->isKeyword(true);
|
||||
_tokensFrontBack.back->linenr(lineno);
|
||||
_tokensFrontBack.back->fileIndex(fileno);
|
||||
mTokensFrontBack.back->isKeyword(true);
|
||||
mTokensFrontBack.back->linenr(lineno);
|
||||
mTokensFrontBack.back->fileIndex(fileno);
|
||||
}
|
||||
|
||||
void TokenList::addtoken(const Token * tok, const unsigned int lineno, const unsigned int fileno)
|
||||
|
@ -160,19 +160,19 @@ void TokenList::addtoken(const Token * tok, const unsigned int lineno, const uns
|
|||
if (tok == nullptr)
|
||||
return;
|
||||
|
||||
if (_tokensFrontBack.back) {
|
||||
_tokensFrontBack.back->insertToken(tok->str(), tok->originalName());
|
||||
if (mTokensFrontBack.back) {
|
||||
mTokensFrontBack.back->insertToken(tok->str(), tok->originalName());
|
||||
} else {
|
||||
_tokensFrontBack.front = new Token(&_tokensFrontBack);
|
||||
_tokensFrontBack.back = _tokensFrontBack.front;
|
||||
_tokensFrontBack.back->str(tok->str());
|
||||
mTokensFrontBack.front = new Token(&mTokensFrontBack);
|
||||
mTokensFrontBack.back = mTokensFrontBack.front;
|
||||
mTokensFrontBack.back->str(tok->str());
|
||||
if (!tok->originalName().empty())
|
||||
_tokensFrontBack.back->originalName(tok->originalName());
|
||||
mTokensFrontBack.back->originalName(tok->originalName());
|
||||
}
|
||||
|
||||
_tokensFrontBack.back->linenr(lineno);
|
||||
_tokensFrontBack.back->fileIndex(fileno);
|
||||
_tokensFrontBack.back->flags(tok->flags());
|
||||
mTokensFrontBack.back->linenr(lineno);
|
||||
mTokensFrontBack.back->fileIndex(fileno);
|
||||
mTokensFrontBack.back->flags(tok->flags());
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,20 +304,20 @@ void TokenList::createTokens(const simplecpp::TokenList *tokenList)
|
|||
if (str.size() > 1 && str[0] == '.' && std::isdigit(str[1]))
|
||||
str = '0' + str;
|
||||
|
||||
if (_tokensFrontBack.back) {
|
||||
_tokensFrontBack.back->insertToken(str);
|
||||
if (mTokensFrontBack.back) {
|
||||
mTokensFrontBack.back->insertToken(str);
|
||||
} else {
|
||||
_tokensFrontBack.front = new Token(&_tokensFrontBack);
|
||||
_tokensFrontBack.back = _tokensFrontBack.front;
|
||||
_tokensFrontBack.back->str(str);
|
||||
mTokensFrontBack.front = new Token(&mTokensFrontBack);
|
||||
mTokensFrontBack.back = mTokensFrontBack.front;
|
||||
mTokensFrontBack.back->str(str);
|
||||
}
|
||||
|
||||
if (isCPP() && _tokensFrontBack.back->str() == "delete")
|
||||
_tokensFrontBack.back->isKeyword(true);
|
||||
_tokensFrontBack.back->fileIndex(tok->location.fileIndex);
|
||||
_tokensFrontBack.back->linenr(tok->location.line);
|
||||
_tokensFrontBack.back->col(tok->location.col);
|
||||
_tokensFrontBack.back->isExpandedMacro(!tok->macro.empty());
|
||||
if (isCPP() && mTokensFrontBack.back->str() == "delete")
|
||||
mTokensFrontBack.back->isKeyword(true);
|
||||
mTokensFrontBack.back->fileIndex(tok->location.fileIndex);
|
||||
mTokensFrontBack.back->linenr(tok->location.line);
|
||||
mTokensFrontBack.back->col(tok->location.col);
|
||||
mTokensFrontBack.back->isExpandedMacro(!tok->macro.empty());
|
||||
}
|
||||
|
||||
if (mSettings && mSettings->relativePaths) {
|
||||
|
@ -325,7 +325,7 @@ void TokenList::createTokens(const simplecpp::TokenList *tokenList)
|
|||
_files[i] = Path::getRelativePath(_files[i], mSettings->basePaths);
|
||||
}
|
||||
|
||||
Token::assignProgressValues(_tokensFrontBack.front);
|
||||
Token::assignProgressValues(mTokensFrontBack.front);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1163,7 +1163,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
|
||||
void TokenList::createAst()
|
||||
{
|
||||
for (Token *tok = _tokensFrontBack.front; tok; tok = tok ? tok->next() : nullptr) {
|
||||
for (Token *tok = mTokensFrontBack.front; tok; tok = tok ? tok->next() : nullptr) {
|
||||
tok = createAstAtToken(tok, isCPP());
|
||||
}
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ void TokenList::validateAst() const
|
|||
{
|
||||
// Check for some known issues in AST to avoid crash/hang later on
|
||||
std::set < const Token* > safeAstTokens; // list of "safe" AST tokens without endless recursion
|
||||
for (const Token *tok = _tokensFrontBack.front; tok; tok = tok->next()) {
|
||||
for (const Token *tok = mTokensFrontBack.front; tok; tok = tok->next()) {
|
||||
// Syntax error if binary operator only has 1 operand
|
||||
if ((tok->isAssignmentOp() || tok->isComparisonOp() || Token::Match(tok,"[|^/%]")) && tok->astOperand1() && !tok->astOperand2())
|
||||
throw InternalError(tok, "Syntax Error: AST broken, binary operator has only one operand.", InternalError::AST);
|
||||
|
@ -1216,7 +1216,7 @@ bool TokenList::validateToken(const Token* tok) const
|
|||
{
|
||||
if (!tok)
|
||||
return true;
|
||||
for (const Token *t = _tokensFrontBack.front; t; t = t->next()) {
|
||||
for (const Token *t = mTokensFrontBack.front; t; t = t->next()) {
|
||||
if (tok==t)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -105,18 +105,18 @@ public:
|
|||
|
||||
/** get first token of list */
|
||||
const Token *front() const {
|
||||
return _tokensFrontBack.front;
|
||||
return mTokensFrontBack.front;
|
||||
}
|
||||
Token *front() {
|
||||
return _tokensFrontBack.front;
|
||||
return mTokensFrontBack.front;
|
||||
}
|
||||
|
||||
/** get last token of list */
|
||||
const Token *back() const {
|
||||
return _tokensFrontBack.back;
|
||||
return mTokensFrontBack.back;
|
||||
}
|
||||
Token *back() {
|
||||
return _tokensFrontBack.back;
|
||||
return mTokensFrontBack.back;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,7 +182,7 @@ private:
|
|||
TokenList &operator=(const TokenList &);
|
||||
|
||||
/** Token list */
|
||||
TokensFrontBack _tokensFrontBack;
|
||||
TokensFrontBack mTokensFrontBack;
|
||||
|
||||
/** filenames for the tokenized source code (source + included) */
|
||||
std::vector<std::string> _files;
|
||||
|
|
Loading…
Reference in New Issue