astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2020-07-23 10:09:06 +02:00
parent df99d8aa0a
commit 25ad22c6af
4 changed files with 11 additions and 9 deletions

View File

@ -1443,7 +1443,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings *settings,
return false;
const Token *tok2 = tok;
int derefs = 0;
while (Token::simpleMatch(tok2->astParent(), "*") ||
while (Token::simpleMatch(tok2->astParent(), "*") ||
(Token::simpleMatch(tok2->astParent(), ".") && !Token::simpleMatch(tok2->astParent()->astParent(), "(")) ||
(Token::simpleMatch(tok2->astParent(), "[") && tok2 == tok2->astParent()->astOperand1())) {
if (Token::simpleMatch(tok2->astParent(), "*") || tok2->astParent()->originalName() == "->")

View File

@ -425,7 +425,7 @@ static std::list<std::pair<const Token *, MathLib::bigint>> getUnsafeFunction(co
if (Token::findmatch(tok2->link(), "return|throw", tok2))
return ret;
int indirect = 0;
if(argvar->valueType())
if (argvar->valueType())
indirect = argvar->valueType()->pointer;
if (isVariableChanged(tok2->link(), tok2, indirect, argvar->declarationId(), false, settings, tokenizer->isCPP()))
return ret;

View File

@ -2490,7 +2490,9 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
virtual bool isAlias(const Token* tok) const OVERRIDE {
if (value.isLifetimeValue())
return false;
for(const auto& m:{std::ref(getVars()), std::ref(getAliasedVars())}) {
for (const auto& m: {
std::ref(getVars()), std::ref(getAliasedVars())
}) {
for (const auto& p:m.get()) {
nonneg int varid = p.first;
const Variable* var = p.second;
@ -2567,7 +2569,7 @@ struct VariableForwardAnalyzer : SingleValueFlowForwardAnalyzer {
VariableForwardAnalyzer(const Variable* v, const ValueFlow::Value& val, std::vector<const Variable*> paliases, const TokenList* t)
: SingleValueFlowForwardAnalyzer(val, t), var(v) {
varids[var->declarationId()] = var;
for(const Variable* av:paliases) {
for (const Variable* av:paliases) {
if (!av)
continue;
aliases[av->declarationId()] = av;
@ -2616,10 +2618,10 @@ static bool valueFlowForwardVariable(Token* const startToken,
{
std::vector<const Variable*> aliases;
for (const ValueFlow::Value& v : values) {
if (!v.tokvalue)
if (!v.tokvalue)
continue;
const Token* lifeTok = nullptr;
for(const ValueFlow::Value& lv:v.tokvalue->values()) {
for (const ValueFlow::Value& lv:v.tokvalue->values()) {
if (!lv.isLocalLifetimeValue())
continue;
if (lifeTok) {

View File

@ -4174,7 +4174,7 @@ private:
" A *b = v.back();\n"
" v.pop_back();\n"
" delete b;\n"
"}\n" ,true);
"}\n",true);
ASSERT_EQUALS("", errout.str());
check("struct A {};\n"
@ -4185,7 +4185,7 @@ private:
" A *b = v.back();\n"
" v.pop_back();\n"
" delete b;\n"
"}\n" ,true);
"}\n",true);
ASSERT_EQUALS("", errout.str());
check("struct A {};\n"
@ -4196,7 +4196,7 @@ private:
" std::shared_ptr<A> b = v.back();\n"
" v.pop_back();\n"
" delete b;\n"
"}\n" ,true);
"}\n",true);
ASSERT_EQUALS("", errout.str());
}