diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index a1c536a2e..2f89a4dd5 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3776,6 +3776,15 @@ AccessControl Scope::defaultAccess() const } } +void Scope::addVariable(const Token *token_, const Token *start_, const Token *end_, + AccessControl access_, const Type *type_, const Scope *scope_, const Settings* settings) +{ + // keep possible size_t -> int truncation outside emplace_back() to have a single line + // C4267 VC++ warning instead of several dozens lines + const int varIndex = varlist.size(); + varlist.emplace_back(token_, start_, end_, varIndex, access_, type_, scope_, settings); +} + // Get variable list.. void Scope::getVariableList(const Settings* settings) { diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 485e8af5d..8fdbc20f7 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1081,11 +1081,7 @@ public: void addVariable(const Token *token_, const Token *start_, const Token *end_, AccessControl access_, const Type *type_, - const Scope *scope_, const Settings* settings) { - varlist.emplace_back(token_, start_, end_, varlist.size(), - access_, - type_, scope_, settings); - } + const Scope *scope_, const Settings* settings); /** @brief initialize varlist */ void getVariableList(const Settings* settings);