Avoid giant C4267 warning in 64-bit Visual C++ build (#2569)

This commit is contained in:
Dmitry-Me 2020-03-14 16:41:45 +03:00 committed by GitHub
parent c123b9fcdd
commit ab5835d359
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -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)
{

View File

@ -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);