fixed and enabled performance-for-range-copy clang-tidy warning (#3682)
This commit is contained in:
parent
edc5106237
commit
06d10b7474
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-performance-for-range-copy,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-readability-misleading-indentation,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-readability-misleading-indentation,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
|
|
|
@ -34,7 +34,7 @@ static bool executeCommand(std::string exe, std::vector<std::string> args, std::
|
||||||
output->clear();
|
output->clear();
|
||||||
|
|
||||||
QStringList args2;
|
QStringList args2;
|
||||||
for (std::string arg: args)
|
for (const std::string &arg: args)
|
||||||
args2 << QString::fromStdString(arg);
|
args2 << QString::fromStdString(arg);
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
|
@ -58,7 +58,7 @@ static QString getHelpFile()
|
||||||
paths << (filesdir + "/help")
|
paths << (filesdir + "/help")
|
||||||
<< filesdir;
|
<< filesdir;
|
||||||
#endif
|
#endif
|
||||||
for (QString p: paths) {
|
for (const QString &p: paths) {
|
||||||
QString filename = p + "/online-help.qhc";
|
QString filename = p + "/online-help.qhc";
|
||||||
if (QFileInfo(filename).exists())
|
if (QFileInfo(filename).exists())
|
||||||
return filename;
|
return filename;
|
||||||
|
|
|
@ -624,7 +624,7 @@ void MainWindow::updateVariableContractsTab()
|
||||||
{
|
{
|
||||||
QStringList added;
|
QStringList added;
|
||||||
if (mProjectFile) {
|
if (mProjectFile) {
|
||||||
for (auto vc: mProjectFile->getVariableContracts()) {
|
for (const auto &vc: mProjectFile->getVariableContracts()) {
|
||||||
QString line = vc.first;
|
QString line = vc.first;
|
||||||
if (!vc.second.minValue.empty())
|
if (!vc.second.minValue.empty())
|
||||||
line += " min:" + QString::fromStdString(vc.second.minValue);
|
line += " min:" + QString::fromStdString(vc.second.minValue);
|
||||||
|
|
|
@ -973,7 +973,7 @@ bool ProjectFile::write(const QString &filename)
|
||||||
if (!mVariableContracts.empty()) {
|
if (!mVariableContracts.empty()) {
|
||||||
xmlWriter.writeStartElement(CppcheckXml::VariableContractsElementName);
|
xmlWriter.writeStartElement(CppcheckXml::VariableContractsElementName);
|
||||||
|
|
||||||
for (auto vc: mVariableContracts) {
|
for (const auto &vc: mVariableContracts) {
|
||||||
xmlWriter.writeStartElement(CppcheckXml::VariableContractItemElementName);
|
xmlWriter.writeStartElement(CppcheckXml::VariableContractItemElementName);
|
||||||
xmlWriter.writeAttribute(CppcheckXml::VariableContractVarName, vc.first);
|
xmlWriter.writeAttribute(CppcheckXml::VariableContractVarName, vc.first);
|
||||||
xmlWriter.writeAttribute(CppcheckXml::VariableContractMin, QString::fromStdString(vc.second.minValue));
|
xmlWriter.writeAttribute(CppcheckXml::VariableContractMin, QString::fromStdString(vc.second.minValue));
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void bufferOverflow(const Token *tok, const ExprEngine::Value &value, Exp
|
||||||
int overflowArgument = 0;
|
int overflowArgument = 0;
|
||||||
bool bailout = false;
|
bool bailout = false;
|
||||||
|
|
||||||
for (auto argNrChecks: func->argumentChecks) {
|
for (const auto &argNrChecks: func->argumentChecks) {
|
||||||
const int argnr = argNrChecks.first;
|
const int argnr = argNrChecks.first;
|
||||||
const Library::ArgumentChecks &checks = argNrChecks.second;
|
const Library::ArgumentChecks &checks = argNrChecks.second;
|
||||||
if (argnr <= 0 || argnr > arguments.size() || checks.minsizes.empty())
|
if (argnr <= 0 || argnr > arguments.size() || checks.minsizes.empty())
|
||||||
|
|
|
@ -277,7 +277,7 @@ namespace clangimport {
|
||||||
std::vector<const Variable *> getVariableList() const {
|
std::vector<const Variable *> getVariableList() const {
|
||||||
std::vector<const Variable *> ret;
|
std::vector<const Variable *> ret;
|
||||||
ret.resize(mVarId + 1, nullptr);
|
ret.resize(mVarId + 1, nullptr);
|
||||||
for (auto it: mDeclMap) {
|
for (const auto& it: mDeclMap) {
|
||||||
if (it.second.var)
|
if (it.second.var)
|
||||||
ret[it.second.var->declarationId()] = it.second.var;
|
ret[it.second.var->declarationId()] = it.second.var;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ std::string clangimport::AstNode::getTemplateParameters() const
|
||||||
if (children.empty() || children[0]->nodeType != TemplateArgument)
|
if (children.empty() || children[0]->nodeType != TemplateArgument)
|
||||||
return "";
|
return "";
|
||||||
std::string templateParameters;
|
std::string templateParameters;
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr& child: children) {
|
||||||
if (child->nodeType == TemplateArgument) {
|
if (child->nodeType == TemplateArgument) {
|
||||||
if (templateParameters.empty())
|
if (templateParameters.empty())
|
||||||
templateParameters = "<";
|
templateParameters = "<";
|
||||||
|
@ -483,7 +483,7 @@ void clangimport::AstNode::dumpAst(int num, int indent) const
|
||||||
{
|
{
|
||||||
(void)num;
|
(void)num;
|
||||||
std::cout << std::string(indent, ' ') << nodeType;
|
std::cout << std::string(indent, ' ') << nodeType;
|
||||||
for (auto tok: mExtTokens)
|
for (const auto& tok: mExtTokens)
|
||||||
std::cout << " " << tok;
|
std::cout << " " << tok;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
for (int c = 0; c < children.size(); ++c) {
|
for (int c = 0; c < children.size(); ++c) {
|
||||||
|
@ -513,7 +513,7 @@ void clangimport::AstNode::setLocations(TokenList *tokenList, int file, int line
|
||||||
mFile = file;
|
mFile = file;
|
||||||
mLine = line;
|
mLine = line;
|
||||||
mCol = col;
|
mCol = col;
|
||||||
for (auto child: children) {
|
for (const auto& child: children) {
|
||||||
if (child)
|
if (child)
|
||||||
child->setLocations(tokenList, file, line, col);
|
child->setLocations(tokenList, file, line, col);
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ Scope *clangimport::AstNode::createScope(TokenList *tokenList, Scope::ScopeType
|
||||||
tokenList->back()->scope(scope);
|
tokenList->back()->scope(scope);
|
||||||
mData->scopeAccessControl[scope] = scope->defaultAccess();
|
mData->scopeAccessControl[scope] = scope->defaultAccess();
|
||||||
if (!children2.empty()) {
|
if (!children2.empty()) {
|
||||||
for (AstNodePtr astNode: children2) {
|
for (const AstNodePtr &astNode: children2) {
|
||||||
if (astNode->nodeType == "VisibilityAttr")
|
if (astNode->nodeType == "VisibilityAttr")
|
||||||
continue;
|
continue;
|
||||||
if (astNode->nodeType == AccessSpecDecl) {
|
if (astNode->nodeType == AccessSpecDecl) {
|
||||||
|
@ -756,7 +756,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (nodeType == ClassTemplateDecl) {
|
if (nodeType == ClassTemplateDecl) {
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr& child: children) {
|
||||||
if (child->nodeType == ClassTemplateSpecializationDecl)
|
if (child->nodeType == ClassTemplateSpecializationDecl)
|
||||||
child->createTokens(tokenList);
|
child->createTokens(tokenList);
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
return assign;
|
return assign;
|
||||||
}
|
}
|
||||||
if (nodeType == CompoundStmt) {
|
if (nodeType == CompoundStmt) {
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr& child: children) {
|
||||||
child->createTokens(tokenList);
|
child->createTokens(tokenList);
|
||||||
if (!Token::Match(tokenList->back(), "[;{}]"))
|
if (!Token::Match(tokenList->back(), "[;{}]"))
|
||||||
child->addtoken(tokenList, ";");
|
child->addtoken(tokenList, ";");
|
||||||
|
@ -1043,7 +1043,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
}
|
}
|
||||||
if (nodeType == FunctionTemplateDecl) {
|
if (nodeType == FunctionTemplateDecl) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr& child: children) {
|
||||||
if (child->nodeType == FunctionDecl) {
|
if (child->nodeType == FunctionDecl) {
|
||||||
if (!first)
|
if (!first)
|
||||||
child->createTokens(tokenList);
|
child->createTokens(tokenList);
|
||||||
|
@ -1095,7 +1095,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
const Scope *scope = tokenList->back()->scope();
|
const Scope *scope = tokenList->back()->scope();
|
||||||
Token *start = addtoken(tokenList, "{");
|
Token *start = addtoken(tokenList, "{");
|
||||||
start->scope(scope);
|
start->scope(scope);
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr& child: children) {
|
||||||
if (tokenList->back()->str() != "{")
|
if (tokenList->back()->str() != "{")
|
||||||
addtoken(tokenList, ",");
|
addtoken(tokenList, ",");
|
||||||
child->createTokens(tokenList);
|
child->createTokens(tokenList);
|
||||||
|
@ -1112,7 +1112,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
if (nodeType == LabelStmt) {
|
if (nodeType == LabelStmt) {
|
||||||
addtoken(tokenList, unquote(mExtTokens.back()));
|
addtoken(tokenList, unquote(mExtTokens.back()));
|
||||||
addtoken(tokenList, ":");
|
addtoken(tokenList, ":");
|
||||||
for (auto child: children)
|
for (const auto& child: children)
|
||||||
child->createTokens(tokenList);
|
child->createTokens(tokenList);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1430,7 +1430,7 @@ void clangimport::AstNode::createTokensForCXXRecord(TokenList *tokenList)
|
||||||
/*Token *nameToken =*/ addtoken(tokenList, className);
|
/*Token *nameToken =*/ addtoken(tokenList, className);
|
||||||
// base classes
|
// base classes
|
||||||
bool firstBase = true;
|
bool firstBase = true;
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr &child: children) {
|
||||||
if (child->nodeType == "public" || child->nodeType == "protected" || child->nodeType == "private") {
|
if (child->nodeType == "public" || child->nodeType == "protected" || child->nodeType == "private") {
|
||||||
addtoken(tokenList, firstBase ? ":" : ",");
|
addtoken(tokenList, firstBase ? ":" : ",");
|
||||||
addtoken(tokenList, child->nodeType);
|
addtoken(tokenList, child->nodeType);
|
||||||
|
@ -1441,7 +1441,7 @@ void clangimport::AstNode::createTokensForCXXRecord(TokenList *tokenList)
|
||||||
// definition
|
// definition
|
||||||
if (isDefinition()) {
|
if (isDefinition()) {
|
||||||
std::vector<AstNodePtr> children2;
|
std::vector<AstNodePtr> children2;
|
||||||
for (AstNodePtr child: children) {
|
for (const AstNodePtr &child: children) {
|
||||||
if (child->nodeType == CXXConstructorDecl ||
|
if (child->nodeType == CXXConstructorDecl ||
|
||||||
child->nodeType == CXXDestructorDecl ||
|
child->nodeType == CXXDestructorDecl ||
|
||||||
child->nodeType == CXXMethodDecl ||
|
child->nodeType == CXXMethodDecl ||
|
||||||
|
|
|
@ -297,7 +297,7 @@ namespace {
|
||||||
|
|
||||||
void print(std::ostream &out) {
|
void print(std::ostream &out) {
|
||||||
std::set<std::pair<int,int>> locations;
|
std::set<std::pair<int,int>> locations;
|
||||||
for (auto it : mMap) {
|
for (const auto& it : mMap) {
|
||||||
locations.insert(std::pair<int,int>(it.first->linenr(), it.first->column()));
|
locations.insert(std::pair<int,int>(it.first->linenr(), it.first->column()));
|
||||||
}
|
}
|
||||||
for (const std::pair<int,int> &loc : locations) {
|
for (const std::pair<int,int> &loc : locations) {
|
||||||
|
@ -553,7 +553,7 @@ namespace {
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "D" << mDataIndex << ":" << "memory:{";
|
s << "D" << mDataIndex << ":" << "memory:{";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto mem : memory) {
|
for (const auto &mem : memory) {
|
||||||
ExprEngine::ValuePtr value = mem.second;
|
ExprEngine::ValuePtr value = mem.second;
|
||||||
const Variable *var = symbolDatabase->getVariableFromVarId(mem.first);
|
const Variable *var = symbolDatabase->getVariableFromVarId(mem.first);
|
||||||
if (!var)
|
if (!var)
|
||||||
|
@ -574,7 +574,7 @@ namespace {
|
||||||
if (!constraints.empty()) {
|
if (!constraints.empty()) {
|
||||||
s << " constraints:{";
|
s << " constraints:{";
|
||||||
first = true;
|
first = true;
|
||||||
for (auto constraint: constraints) {
|
for (const auto &constraint: constraints) {
|
||||||
if (!first)
|
if (!first)
|
||||||
s << " ";
|
s << " ";
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -693,7 +693,7 @@ namespace {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::map<std::string, ExprEngine::ValuePtr> symbols;
|
std::map<std::string, ExprEngine::ValuePtr> symbols;
|
||||||
for (auto mem: memory) {
|
for (const auto &mem: memory) {
|
||||||
getSymbols(symbols, mem.second);
|
getSymbols(symbols, mem.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,15 +811,15 @@ namespace {
|
||||||
return;
|
return;
|
||||||
symbols[val->name] = val;
|
symbols[val->name] = val;
|
||||||
if (auto arrayValue = std::dynamic_pointer_cast<ExprEngine::ArrayValue>(val)) {
|
if (auto arrayValue = std::dynamic_pointer_cast<ExprEngine::ArrayValue>(val)) {
|
||||||
for (auto sizeValue: arrayValue->size)
|
for (const auto &sizeValue: arrayValue->size)
|
||||||
getSymbols(symbols, sizeValue);
|
getSymbols(symbols, sizeValue);
|
||||||
for (auto indexValue: arrayValue->data) {
|
for (const auto &indexValue: arrayValue->data) {
|
||||||
getSymbols(symbols, indexValue.index);
|
getSymbols(symbols, indexValue.index);
|
||||||
getSymbols(symbols, indexValue.value);
|
getSymbols(symbols, indexValue.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto structValue = std::dynamic_pointer_cast<ExprEngine::StructValue>(val)) {
|
if (auto structValue = std::dynamic_pointer_cast<ExprEngine::StructValue>(val)) {
|
||||||
for (auto memberNameValue: structValue->member)
|
for (const auto &memberNameValue: structValue->member)
|
||||||
getSymbols(symbols, memberNameValue.second);
|
getSymbols(symbols, memberNameValue.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1053,7 @@ std::string ExprEngine::ConditionalValue::getSymbolicExpression() const
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << "{";
|
ostr << "{";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto condvalue : values) {
|
for (const auto& condvalue : values) {
|
||||||
ValuePtr cond = condvalue.first;
|
ValuePtr cond = condvalue.first;
|
||||||
ValuePtr value = condvalue.second;
|
ValuePtr value = condvalue.second;
|
||||||
|
|
||||||
|
@ -1134,12 +1134,12 @@ public:
|
||||||
AssertionList assertionList;
|
AssertionList assertionList;
|
||||||
|
|
||||||
void addAssertions(z3::solver &solver) const {
|
void addAssertions(z3::solver &solver) const {
|
||||||
for (auto assertExpr : assertionList)
|
for (const auto &assertExpr : assertionList)
|
||||||
solver.add(assertExpr);
|
solver.add(assertExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addConstraints(z3::solver &solver, const Data* data) {
|
void addConstraints(z3::solver &solver, const Data* data) {
|
||||||
for (auto constraint : data->constraints) {
|
for (const auto &constraint : data->constraints) {
|
||||||
try {
|
try {
|
||||||
solver.add(getConstraintExpr(constraint));
|
solver.add(getConstraintExpr(constraint));
|
||||||
} catch (const BailoutValueException &) {}
|
} catch (const BailoutValueException &) {}
|
||||||
|
@ -1765,7 +1765,7 @@ static ExprEngine::ValuePtr getValueRangeFromValueType(const ValueType *valueTyp
|
||||||
static void call(const std::vector<ExprEngine::Callback> &callbacks, const Token *tok, ExprEngine::ValuePtr value, Data *dataBase)
|
static void call(const std::vector<ExprEngine::Callback> &callbacks, const Token *tok, ExprEngine::ValuePtr value, Data *dataBase)
|
||||||
{
|
{
|
||||||
if (value) {
|
if (value) {
|
||||||
for (ExprEngine::Callback f : callbacks) {
|
for (const ExprEngine::Callback& f : callbacks) {
|
||||||
try {
|
try {
|
||||||
f(tok, *value, dataBase);
|
f(tok, *value, dataBase);
|
||||||
} catch (const ExprEngineException &e) {
|
} catch (const ExprEngineException &e) {
|
||||||
|
@ -2014,7 +2014,7 @@ static void checkContract(Data &data, const Token *tok, const Function *function
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bailoutValue) {
|
if (!bailoutValue) {
|
||||||
for (auto constraint : data.constraints)
|
for (const auto &constraint : data.constraints)
|
||||||
solver.add(exprData.getConstraintExpr(constraint));
|
solver.add(exprData.getConstraintExpr(constraint));
|
||||||
|
|
||||||
exprData.addAssertions(solver);
|
exprData.addAssertions(solver);
|
||||||
|
@ -2192,7 +2192,7 @@ static ExprEngine::ValuePtr executeArrayIndex(const Token *tok, Data &data)
|
||||||
if (arrayValue) {
|
if (arrayValue) {
|
||||||
auto indexValue = calculateArrayIndex(tok, data, *arrayValue);
|
auto indexValue = calculateArrayIndex(tok, data, *arrayValue);
|
||||||
auto conditionalValues = arrayValue->read(indexValue);
|
auto conditionalValues = arrayValue->read(indexValue);
|
||||||
for (auto value: conditionalValues)
|
for (const auto& value: conditionalValues)
|
||||||
call(data.callbacks, tok, value.second, &data);
|
call(data.callbacks, tok, value.second, &data);
|
||||||
if (conditionalValues.size() == 1 && !conditionalValues[0].first)
|
if (conditionalValues.size() == 1 && !conditionalValues[0].first)
|
||||||
return conditionalValues[0].second;
|
return conditionalValues[0].second;
|
||||||
|
@ -2257,7 +2257,7 @@ static ExprEngine::ValuePtr executeDot(const Token *tok, Data &data)
|
||||||
call(data.callbacks, tok->astOperand1(), pointerValue, &data);
|
call(data.callbacks, tok->astOperand1(), pointerValue, &data);
|
||||||
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
||||||
ExprEngine::ValuePtr ret;
|
ExprEngine::ValuePtr ret;
|
||||||
for (auto val: pointerValue->read(indexValue)) {
|
for (const auto& val: pointerValue->read(indexValue)) {
|
||||||
structValue = std::dynamic_pointer_cast<ExprEngine::StructValue>(val.second);
|
structValue = std::dynamic_pointer_cast<ExprEngine::StructValue>(val.second);
|
||||||
if (structValue) {
|
if (structValue) {
|
||||||
auto memberValue = structValue->getValueOfMember(tok->astOperand2()->str());
|
auto memberValue = structValue->getValueOfMember(tok->astOperand2()->str());
|
||||||
|
@ -2386,7 +2386,7 @@ static ExprEngine::ValuePtr executeDeref(const Token *tok, Data &data)
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
||||||
auto conditionalValues = pointer->read(indexValue);
|
auto conditionalValues = pointer->read(indexValue);
|
||||||
for (auto value: conditionalValues)
|
for (const auto& value: conditionalValues)
|
||||||
call(data.callbacks, tok, value.second, &data);
|
call(data.callbacks, tok, value.second, &data);
|
||||||
if (conditionalValues.size() == 1 && !conditionalValues[0].first)
|
if (conditionalValues.size() == 1 && !conditionalValues[0].first)
|
||||||
return conditionalValues[0].second;
|
return conditionalValues[0].second;
|
||||||
|
@ -2803,7 +2803,7 @@ static std::string execute(const Token *start, const Token *end, Data &data)
|
||||||
if (auto structPtr = std::dynamic_pointer_cast<ExprEngine::ArrayValue>(structVal1)) {
|
if (auto structPtr = std::dynamic_pointer_cast<ExprEngine::ArrayValue>(structVal1)) {
|
||||||
if (structPtr->pointer && !structPtr->data.empty()) {
|
if (structPtr->pointer && !structPtr->data.empty()) {
|
||||||
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
auto indexValue = std::make_shared<ExprEngine::IntRange>("0", 0, 0);
|
||||||
for (auto val: structPtr->read(indexValue)) {
|
for (const auto &val: structPtr->read(indexValue)) {
|
||||||
structVal = std::dynamic_pointer_cast<ExprEngine::StructValue>(val.second);
|
structVal = std::dynamic_pointer_cast<ExprEngine::StructValue>(val.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3131,7 +3131,7 @@ static void dumpRecursive(ExprEngine::ValuePtr val)
|
||||||
case ExprEngine::ValueType::FunctionCallArgumentValues: {
|
case ExprEngine::ValueType::FunctionCallArgumentValues: {
|
||||||
std::cout << "FunctionCallArgumentValues(";
|
std::cout << "FunctionCallArgumentValues(";
|
||||||
const char *sep = "";
|
const char *sep = "";
|
||||||
for (auto arg: std::dynamic_pointer_cast<ExprEngine::FunctionCallArgumentValues>(val)->argValues) {
|
for (const auto &arg: std::dynamic_pointer_cast<ExprEngine::FunctionCallArgumentValues>(val)->argValues) {
|
||||||
std::cout << sep;
|
std::cout << sep;
|
||||||
sep = ",";
|
sep = ",";
|
||||||
if (!arg)
|
if (!arg)
|
||||||
|
|
|
@ -775,7 +775,7 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
|
||||||
|
|
||||||
if (!guiProject.checkVsConfigs.empty()) {
|
if (!guiProject.checkVsConfigs.empty()) {
|
||||||
bool doChecking = false;
|
bool doChecking = false;
|
||||||
for (std::string config : guiProject.checkVsConfigs)
|
for (const std::string& config : guiProject.checkVsConfigs)
|
||||||
if (config == p.configuration) {
|
if (config == p.configuration) {
|
||||||
doChecking = true;
|
doChecking = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,7 +61,7 @@ std::string Summaries::create(const Tokenizer *tokenizer, const std::string &cfg
|
||||||
auto join = [](const std::set<std::string> &data) -> std::string {
|
auto join = [](const std::set<std::string> &data) -> std::string {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
const char *sep = "";
|
const char *sep = "";
|
||||||
for (std::string d: data)
|
for (const std::string &d: data)
|
||||||
{
|
{
|
||||||
ret += sep + d;
|
ret += sep + d;
|
||||||
sep = ",";
|
sep = ",";
|
||||||
|
|
|
@ -2134,7 +2134,7 @@ namespace {
|
||||||
if (tempScope->usingNamespaces.find(scope) != tempScope->usingNamespaces.end())
|
if (tempScope->usingNamespaces.find(scope) != tempScope->usingNamespaces.end())
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
for (auto ns : tempScope->usingNamespaces) {
|
for (const auto &ns : tempScope->usingNamespaces) {
|
||||||
if (scope == ns + " :: " + qualification)
|
if (scope == ns + " :: " + qualification)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue