Tokenizer: moved `VariableMap` into anonymous namespace (#5686)
This commit is contained in:
parent
f5630e7049
commit
2b61c9ef2f
|
@ -206,7 +206,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
||||||
// skip variable declaration
|
// skip variable declaration
|
||||||
else if (Token::Match(tok2, "*|&|>"))
|
else if (Token::Match(tok2, "*|&|>"))
|
||||||
continue;
|
continue;
|
||||||
else if (Token::Match(tok2, "%name% (") && mTokenizer.isFunctionHead(tok2->next(), "{;"))
|
else if (Token::Match(tok2, "%name% (") && Tokenizer::isFunctionHead(tok2->next(), "{;"))
|
||||||
continue;
|
continue;
|
||||||
else if (Token::Match(tok2, "%name% [|="))
|
else if (Token::Match(tok2, "%name% [|="))
|
||||||
continue;
|
continue;
|
||||||
|
@ -531,7 +531,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
||||||
// class function?
|
// class function?
|
||||||
else if (isFunction(tok, scope, &funcStart, &argStart, &declEnd)) {
|
else if (isFunction(tok, scope, &funcStart, &argStart, &declEnd)) {
|
||||||
if (tok->previous()->str() != "::" || tok->strAt(-2) == scope->className) {
|
if (tok->previous()->str() != "::" || tok->strAt(-2) == scope->className) {
|
||||||
Function function(&mTokenizer, tok, scope, funcStart, argStart);
|
Function function(tok, scope, funcStart, argStart);
|
||||||
|
|
||||||
// save the access type
|
// save the access type
|
||||||
function.access = access[scope];
|
function.access = access[scope];
|
||||||
|
@ -547,7 +547,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
||||||
function.arg = function.argDef;
|
function.arg = function.argDef;
|
||||||
|
|
||||||
// out of line function
|
// out of line function
|
||||||
if (const Token *endTok = mTokenizer.isFunctionHead(end, ";")) {
|
if (const Token *endTok = Tokenizer::isFunctionHead(end, ";")) {
|
||||||
tok = endTok;
|
tok = endTok;
|
||||||
scope->addFunction(function);
|
scope->addFunction(function);
|
||||||
}
|
}
|
||||||
|
@ -1864,7 +1864,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
|
||||||
const Token* tok1 = tok->previous();
|
const Token* tok1 = tok->previous();
|
||||||
const Token* tok2 = tok->next()->link()->next();
|
const Token* tok2 = tok->next()->link()->next();
|
||||||
|
|
||||||
if (!mTokenizer.isFunctionHead(tok->next(), ";:{"))
|
if (!Tokenizer::isFunctionHead(tok->next(), ";:{"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// skip over destructor "~"
|
// skip over destructor "~"
|
||||||
|
@ -2418,8 +2418,7 @@ static bool isOperator(const Token *tokenDef)
|
||||||
return name.size() > 8 && startsWith(name,"operator") && std::strchr("+-*/%&|~^<>!=[(", name[8]);
|
return name.size() > 8 && startsWith(name,"operator") && std::strchr("+-*/%&|~^<>!=[(", name[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function::Function(const Tokenizer *mTokenizer,
|
Function::Function(const Token *tok,
|
||||||
const Token *tok,
|
|
||||||
const Scope *scope,
|
const Scope *scope,
|
||||||
const Token *tokDef,
|
const Token *tokDef,
|
||||||
const Token *tokArgDef)
|
const Token *tokArgDef)
|
||||||
|
@ -2520,7 +2519,7 @@ Function::Function(const Tokenizer *mTokenizer,
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTokenizer->isFunctionHead(end, ":{")) {
|
if (Tokenizer::isFunctionHead(end, ":{")) {
|
||||||
// assume implementation is inline (definition and implementation same)
|
// assume implementation is inline (definition and implementation same)
|
||||||
token = tokenDef;
|
token = tokenDef;
|
||||||
arg = argDef;
|
arg = argDef;
|
||||||
|
@ -3168,7 +3167,7 @@ Function* SymbolDatabase::addGlobalFunction(Scope*& scope, const Token*& tok, co
|
||||||
|
|
||||||
Function* SymbolDatabase::addGlobalFunctionDecl(Scope*& scope, const Token *tok, const Token *argStart, const Token* funcStart)
|
Function* SymbolDatabase::addGlobalFunctionDecl(Scope*& scope, const Token *tok, const Token *argStart, const Token* funcStart)
|
||||||
{
|
{
|
||||||
Function function(&mTokenizer, tok, scope, funcStart, argStart);
|
Function function(tok, scope, funcStart, argStart);
|
||||||
scope->addFunction(std::move(function));
|
scope->addFunction(std::move(function));
|
||||||
return &scope->functionList.back();
|
return &scope->functionList.back();
|
||||||
}
|
}
|
||||||
|
@ -3232,7 +3231,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
||||||
if (!func->hasBody()) {
|
if (!func->hasBody()) {
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
const Token *eq = mTokenizer.isFunctionHead(closeParen, ";");
|
const Token *eq = Tokenizer::isFunctionHead(closeParen, ";");
|
||||||
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
|
@ -3305,7 +3304,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
||||||
if (func->argsMatch(scope1, func->argDef, (*tok)->next(), path, path_length)) {
|
if (func->argsMatch(scope1, func->argDef, (*tok)->next(), path, path_length)) {
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
const Token *eq = mTokenizer.isFunctionHead(closeParen, ";");
|
const Token *eq = Tokenizer::isFunctionHead(closeParen, ";");
|
||||||
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -749,7 +749,7 @@ class CPPCHECKLIB Function {
|
||||||
public:
|
public:
|
||||||
enum Type { eConstructor, eCopyConstructor, eMoveConstructor, eOperatorEqual, eDestructor, eFunction, eLambda };
|
enum Type { eConstructor, eCopyConstructor, eMoveConstructor, eOperatorEqual, eDestructor, eFunction, eLambda };
|
||||||
|
|
||||||
Function(const Tokenizer *mTokenizer, const Token *tok, const Scope *scope, const Token *tokDef, const Token *tokArgDef);
|
Function(const Token *tok, const Scope *scope, const Token *tokDef, const Token *tokArgDef);
|
||||||
Function(const Token *tokenDef, const std::string &clangType);
|
Function(const Token *tokenDef, const std::string &clangType);
|
||||||
|
|
||||||
const std::string &name() const {
|
const std::string &name() const {
|
||||||
|
@ -1438,7 +1438,7 @@ private:
|
||||||
void debugSymbolDatabase() const;
|
void debugSymbolDatabase() const;
|
||||||
|
|
||||||
void addClassFunction(Scope **scope, const Token **tok, const Token *argStart);
|
void addClassFunction(Scope **scope, const Token **tok, const Token *argStart);
|
||||||
Function *addGlobalFunctionDecl(Scope*& scope, const Token* tok, const Token *argStart, const Token* funcStart);
|
static Function *addGlobalFunctionDecl(Scope*& scope, const Token* tok, const Token *argStart, const Token* funcStart);
|
||||||
Function *addGlobalFunction(Scope*& scope, const Token*& tok, const Token *argStart, const Token* funcStart);
|
Function *addGlobalFunction(Scope*& scope, const Token*& tok, const Token *argStart, const Token* funcStart);
|
||||||
void addNewFunction(Scope **scope, const Token **tok);
|
void addNewFunction(Scope **scope, const Token **tok);
|
||||||
bool isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart, const Token** declEnd) const;
|
bool isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart, const Token** declEnd) const;
|
||||||
|
|
|
@ -1422,14 +1422,14 @@ bool TemplateSimplifier::getTemplateNamePositionTemplateFunction(const Token *to
|
||||||
} else if (Token::Match(tok->next(), "%type% <")) {
|
} else if (Token::Match(tok->next(), "%type% <")) {
|
||||||
const Token *closing = tok->tokAt(2)->findClosingBracket();
|
const Token *closing = tok->tokAt(2)->findClosingBracket();
|
||||||
if (closing) {
|
if (closing) {
|
||||||
if (closing->strAt(1) == "(" && Tokenizer::isFunctionHead(closing->next(), ";|{|:", true))
|
if (closing->strAt(1) == "(" && Tokenizer::isFunctionHead(closing->next(), ";|{|:"))
|
||||||
return true;
|
return true;
|
||||||
while (tok->next() && tok->next() != closing) {
|
while (tok->next() && tok->next() != closing) {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
namepos++;
|
namepos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Token::Match(tok->next(), "%type% (") && Tokenizer::isFunctionHead(tok->tokAt(2), ";|{|:", true)) {
|
} else if (Token::Match(tok->next(), "%type% (") && Tokenizer::isFunctionHead(tok->tokAt(2), ";|{|:")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
@ -1934,7 +1934,7 @@ void TemplateSimplifier::expandTemplate(
|
||||||
const Token *tok4 = tok3->next()->findClosingBracket();
|
const Token *tok4 = tok3->next()->findClosingBracket();
|
||||||
while (tok4 && tok4->str() != "(")
|
while (tok4 && tok4->str() != "(")
|
||||||
tok4 = tok4->next();
|
tok4 = tok4->next();
|
||||||
if (!Tokenizer::isFunctionHead(tok4, ":{", true))
|
if (!Tokenizer::isFunctionHead(tok4, ":{"))
|
||||||
continue;
|
continue;
|
||||||
// find function return type start
|
// find function return type start
|
||||||
tok5 = tok5->next()->findClosingBracket();
|
tok5 = tok5->next()->findClosingBracket();
|
||||||
|
|
|
@ -93,12 +93,7 @@ static void skipEnumBody(T **tok)
|
||||||
*tok = defStart->link()->next();
|
*tok = defStart->link()->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &endsWith) const
|
const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &endsWith)
|
||||||
{
|
|
||||||
return Tokenizer::isFunctionHead(tok, endsWith, isCPP());
|
|
||||||
}
|
|
||||||
|
|
||||||
const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &endsWith, bool cpp)
|
|
||||||
{
|
{
|
||||||
if (!tok)
|
if (!tok)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -113,7 +108,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end
|
||||||
}
|
}
|
||||||
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
||||||
}
|
}
|
||||||
if (cpp && tok->str() == ")") {
|
if (tok->isCpp() && tok->str() == ")") {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
while (Token::Match(tok, "const|noexcept|override|final|volatile|mutable|&|&& !!(") ||
|
while (Token::Match(tok, "const|noexcept|override|final|volatile|mutable|&|&& !!(") ||
|
||||||
(Token::Match(tok, "%name% !!(") && tok->isUpperCaseName()))
|
(Token::Match(tok, "%name% !!(") && tok->isUpperCaseName()))
|
||||||
|
@ -2791,7 +2786,7 @@ namespace {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool Tokenizer::isMemberFunction(const Token *openParen) const
|
bool Tokenizer::isMemberFunction(const Token *openParen)
|
||||||
{
|
{
|
||||||
return (Token::Match(openParen->tokAt(-2), ":: %name% (") ||
|
return (Token::Match(openParen->tokAt(-2), ":: %name% (") ||
|
||||||
Token::Match(openParen->tokAt(-3), ":: ~ %name% (")) &&
|
Token::Match(openParen->tokAt(-3), ":: ~ %name% (")) &&
|
||||||
|
@ -3901,7 +3896,7 @@ const Token * Tokenizer::startOfExecutableScope(const Token * tok)
|
||||||
if (tok->str() != ")")
|
if (tok->str() != ")")
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
tok = isFunctionHead(tok, ":{", true);
|
tok = Tokenizer::isFunctionHead(tok, ":{");
|
||||||
|
|
||||||
if (Token::Match(tok, ": %name% [({]")) {
|
if (Token::Match(tok, ": %name% [({]")) {
|
||||||
while (Token::Match(tok, "[:,] %name% [({]"))
|
while (Token::Match(tok, "[:,] %name% [({]"))
|
||||||
|
@ -4088,32 +4083,31 @@ void Tokenizer::simplifyTemplates()
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/** Class used in Tokenizer::setVarIdPass1 */
|
namespace {
|
||||||
class VariableMap {
|
/** Class used in Tokenizer::setVarIdPass1 */
|
||||||
private:
|
class VariableMap {
|
||||||
std::unordered_map<std::string, nonneg int> mVariableId;
|
private:
|
||||||
std::unordered_map<std::string, nonneg int> mVariableId_global;
|
std::unordered_map<std::string, nonneg int> mVariableId;
|
||||||
std::stack<std::vector<std::pair<std::string, nonneg int>>> mScopeInfo;
|
std::unordered_map<std::string, nonneg int> mVariableId_global;
|
||||||
mutable nonneg int mVarId{};
|
std::stack<std::vector<std::pair<std::string, nonneg int>>> mScopeInfo;
|
||||||
public:
|
mutable nonneg int mVarId{};
|
||||||
VariableMap() = default;
|
public:
|
||||||
void enterScope();
|
VariableMap() = default;
|
||||||
bool leaveScope();
|
void enterScope();
|
||||||
void addVariable(const std::string& varname, bool globalNamespace);
|
bool leaveScope();
|
||||||
bool hasVariable(const std::string& varname) const {
|
void addVariable(const std::string& varname, bool globalNamespace);
|
||||||
return mVariableId.find(varname) != mVariableId.end();
|
bool hasVariable(const std::string& varname) const {
|
||||||
}
|
return mVariableId.find(varname) != mVariableId.end();
|
||||||
|
}
|
||||||
|
|
||||||
const std::unordered_map<std::string, nonneg int>& map(bool global) const {
|
const std::unordered_map<std::string, nonneg int>& map(bool global) const {
|
||||||
return global ? mVariableId_global : mVariableId;
|
return global ? mVariableId_global : mVariableId;
|
||||||
}
|
}
|
||||||
nonneg int getVarId() const {
|
nonneg int& getVarId() {
|
||||||
return mVarId;
|
return mVarId;
|
||||||
}
|
}
|
||||||
nonneg int& getVarId() {
|
};
|
||||||
return mVarId;
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void VariableMap::enterScope()
|
void VariableMap::enterScope()
|
||||||
|
@ -4298,9 +4292,9 @@ static bool setVarIdParseDeclaration(Token** tok, const VariableMap& variableMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tokenizer::setVarIdStructMembers(Token **tok1,
|
static void setVarIdStructMembers(Token **tok1,
|
||||||
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers,
|
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers,
|
||||||
nonneg int &varId) const
|
nonneg int &varId)
|
||||||
{
|
{
|
||||||
Token *tok = *tok1;
|
Token *tok = *tok1;
|
||||||
|
|
||||||
|
@ -4334,7 +4328,7 @@ void Tokenizer::setVarIdStructMembers(Token **tok1,
|
||||||
while (Token::Match(tok->next(), ")| . %name% !!(")) {
|
while (Token::Match(tok->next(), ")| . %name% !!(")) {
|
||||||
// Don't set varid for trailing return type
|
// Don't set varid for trailing return type
|
||||||
if (tok->strAt(1) == ")" && (tok->linkAt(1)->previous()->isName() || tok->linkAt(1)->strAt(-1) == "]") &&
|
if (tok->strAt(1) == ")" && (tok->linkAt(1)->previous()->isName() || tok->linkAt(1)->strAt(-1) == "]") &&
|
||||||
isFunctionHead(tok->linkAt(1), "{|;")) {
|
Tokenizer::isFunctionHead(tok->linkAt(1), "{|;")) {
|
||||||
tok = tok->tokAt(3);
|
tok = tok->tokAt(3);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4363,10 +4357,10 @@ void Tokenizer::setVarIdStructMembers(Token **tok1,
|
||||||
*tok1 = tok;
|
*tok1 = tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tokenizer::setVarIdClassDeclaration(Token* const startToken,
|
static bool setVarIdClassDeclaration(Token* const startToken,
|
||||||
VariableMap& variableMap,
|
VariableMap& variableMap,
|
||||||
const nonneg int scopeStartVarId,
|
const nonneg int scopeStartVarId,
|
||||||
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers)
|
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers)
|
||||||
{
|
{
|
||||||
// end of scope
|
// end of scope
|
||||||
const Token* const endToken = startToken->link();
|
const Token* const endToken = startToken->link();
|
||||||
|
@ -4389,7 +4383,7 @@ void Tokenizer::setVarIdClassDeclaration(Token* const startToken,
|
||||||
const Token *initListArgLastToken = nullptr;
|
const Token *initListArgLastToken = nullptr;
|
||||||
for (Token *tok = startToken->next(); tok != endToken; tok = tok->next()) {
|
for (Token *tok = startToken->next(); tok != endToken; tok = tok->next()) {
|
||||||
if (!tok)
|
if (!tok)
|
||||||
syntaxError(nullptr);
|
return false;
|
||||||
if (initList) {
|
if (initList) {
|
||||||
if (tok == initListArgLastToken)
|
if (tok == initListArgLastToken)
|
||||||
initListArgLastToken = nullptr;
|
initListArgLastToken = nullptr;
|
||||||
|
@ -4416,7 +4410,7 @@ void Tokenizer::setVarIdClassDeclaration(Token* const startToken,
|
||||||
if (Token::Match(tok->previous(), "::|.") && tok->strAt(-2) != "this" && !Token::simpleMatch(tok->tokAt(-5), "( * this ) ."))
|
if (Token::Match(tok->previous(), "::|.") && tok->strAt(-2) != "this" && !Token::simpleMatch(tok->tokAt(-5), "( * this ) ."))
|
||||||
continue;
|
continue;
|
||||||
if (!tok->next())
|
if (!tok->next())
|
||||||
syntaxError(nullptr);
|
return false;
|
||||||
if (tok->next()->str() == "::") {
|
if (tok->next()->str() == "::") {
|
||||||
if (tok->str() == className)
|
if (tok->str() == className)
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
|
@ -4435,6 +4429,7 @@ void Tokenizer::setVarIdClassDeclaration(Token* const startToken,
|
||||||
} else if (indentlevel == 0 && tok->str() == ":" && !initListArgLastToken)
|
} else if (indentlevel == 0 && tok->str() == ":" && !initListArgLastToken)
|
||||||
initList = true;
|
initList = true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4602,10 +4597,12 @@ void Tokenizer::setVarIdPass1()
|
||||||
}
|
}
|
||||||
// Set variable ids in class declaration..
|
// Set variable ids in class declaration..
|
||||||
if (!initlist && !isC() && !scopeStack.top().isExecutable && tok->link() && !isNamespace) {
|
if (!initlist && !isC() && !scopeStack.top().isExecutable && tok->link() && !isNamespace) {
|
||||||
setVarIdClassDeclaration(tok->link(),
|
if (!setVarIdClassDeclaration(tok->link(),
|
||||||
variableMap,
|
variableMap,
|
||||||
scopeStack.top().startVarid,
|
scopeStack.top().startVarid,
|
||||||
structMembers);
|
structMembers)) {
|
||||||
|
syntaxError(nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scopeStack.top().isStructInit) {
|
if (!scopeStack.top().isStructInit) {
|
||||||
|
@ -9883,7 +9880,7 @@ void Tokenizer::createSymbolDatabase()
|
||||||
mSymbolDatabase->validate();
|
mSymbolDatabase->validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tokenizer::operatorEnd(const Token * tok) const
|
bool Tokenizer::operatorEnd(const Token * tok)
|
||||||
{
|
{
|
||||||
if (tok && tok->str() == ")") {
|
if (tok && tok->str() == ")") {
|
||||||
if (isFunctionHead(tok, "{|;|?|:|["))
|
if (isFunctionHead(tok, "{|;|?|:|["))
|
||||||
|
|
|
@ -38,7 +38,6 @@ class Token;
|
||||||
class TemplateSimplifier;
|
class TemplateSimplifier;
|
||||||
class ErrorLogger;
|
class ErrorLogger;
|
||||||
class Preprocessor;
|
class Preprocessor;
|
||||||
class VariableMap;
|
|
||||||
enum class Severity;
|
enum class Severity;
|
||||||
|
|
||||||
namespace simplecpp {
|
namespace simplecpp {
|
||||||
|
@ -269,7 +268,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
bool isMemberFunction(const Token *openParen) const;
|
static bool isMemberFunction(const Token *openParen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -366,16 +365,7 @@ public:
|
||||||
* @param endsWith string after function head
|
* @param endsWith string after function head
|
||||||
* @return token matching with endsWith if syntax seems to be a function head else nullptr
|
* @return token matching with endsWith if syntax seems to be a function head else nullptr
|
||||||
*/
|
*/
|
||||||
const Token * isFunctionHead(const Token *tok, const std::string &endsWith) const;
|
static const Token * isFunctionHead(const Token *tok, const std::string &endsWith);
|
||||||
|
|
||||||
/**
|
|
||||||
* is token pointing at function head?
|
|
||||||
* @param tok A '(' or ')' token in a possible function head
|
|
||||||
* @param endsWith string after function head
|
|
||||||
* @param cpp c++ code
|
|
||||||
* @return token matching with endsWith if syntax seems to be a function head else nullptr
|
|
||||||
*/
|
|
||||||
static const Token * isFunctionHead(const Token *tok, const std::string &endsWith, bool cpp);
|
|
||||||
|
|
||||||
const Preprocessor *getPreprocessor() const {
|
const Preprocessor *getPreprocessor() const {
|
||||||
assert(mPreprocessor);
|
assert(mPreprocessor);
|
||||||
|
@ -580,21 +570,12 @@ private:
|
||||||
|
|
||||||
void unsupportedTypedef(const Token *tok) const;
|
void unsupportedTypedef(const Token *tok) const;
|
||||||
|
|
||||||
void setVarIdClassDeclaration(Token* const startToken, // cppcheck-suppress functionConst // has side effects
|
static void setVarIdClassFunction(const std::string &classname,
|
||||||
VariableMap& variableMap,
|
Token * const startToken,
|
||||||
const nonneg int scopeStartVarId,
|
const Token * const endToken,
|
||||||
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers);
|
const std::map<std::string, nonneg int> &varlist,
|
||||||
|
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers,
|
||||||
void setVarIdStructMembers(Token **tok1,
|
nonneg int &varId_);
|
||||||
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers,
|
|
||||||
nonneg int &varId) const;
|
|
||||||
|
|
||||||
void setVarIdClassFunction(const std::string &classname, // cppcheck-suppress functionConst // has side effects
|
|
||||||
Token * const startToken,
|
|
||||||
const Token * const endToken,
|
|
||||||
const std::map<std::string, nonneg int> &varlist,
|
|
||||||
std::map<nonneg int, std::map<std::string, nonneg int>>& structMembers,
|
|
||||||
nonneg int &varId_);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output list of unknown types.
|
* Output list of unknown types.
|
||||||
|
@ -604,7 +585,7 @@ private:
|
||||||
/** Find end of SQL (or PL/SQL) block */
|
/** Find end of SQL (or PL/SQL) block */
|
||||||
static const Token *findSQLBlockEnd(const Token *tokSQLStart);
|
static const Token *findSQLBlockEnd(const Token *tokSQLStart);
|
||||||
|
|
||||||
bool operatorEnd(const Token * tok) const;
|
static bool operatorEnd(const Token * tok);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const SymbolDatabase *getSymbolDatabase() const {
|
const SymbolDatabase *getSymbolDatabase() const {
|
||||||
|
|
Loading…
Reference in New Issue