Skip to content

Commit bb451ca

Browse files
committed
Running astlye [ci skip]
1 parent ef6c0e6 commit bb451ca

8 files changed

Lines changed: 44 additions & 41 deletions

File tree

gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ void TestCppcheckLibraryData::podtypeValid()
6565
QCOMPARE(libraryData.podtypes[0].sign.isEmpty(), true);
6666
QCOMPARE(libraryData.podtypes[0].size.isEmpty(), true);
6767

68-
QCOMPARE(libraryData.podtypes[1].name, "ulong");
69-
QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t");
68+
QCOMPARE(libraryData.podtypes[1].name, "ulong");
69+
QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t");
7070
QCOMPARE(libraryData.podtypes[1].sign, "u");
7171
QCOMPARE(libraryData.podtypes[1].size, "4");
7272

lib/checkstl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ void CheckStl::missingComparison()
17411741
if (!tok3)
17421742
break;
17431743
} else if (Token::simpleMatch(tok3->astParent(), "++"))
1744-
incrementToken = tok3;
1744+
incrementToken = tok3;
17451745
else if (Token::simpleMatch(tok3->astParent(), "+")) {
17461746
if (Token::Match(tok3->astSibling(), "%num%")) {
17471747
const Token* tokenGrandParent = tok3->astParent()->astParent();

lib/forwardanalyzer.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ struct ForwardTraversal {
2121
bool analyzeOnly;
2222
Terminate terminate = Terminate::None;
2323

24-
Progress Break(Terminate t = Terminate::None)
25-
{
24+
Progress Break(Terminate t = Terminate::None) {
2625
if (!analyzeOnly && t != Terminate::None)
2726
terminate = t;
2827
return Progress::Break;
@@ -225,15 +224,14 @@ struct ForwardTraversal {
225224
ft.updateRange(start, end);
226225
}
227226

228-
std::vector<ForwardTraversal> forkScope(Token* endBlock, bool isModified = false)
229-
{
227+
std::vector<ForwardTraversal> forkScope(Token* endBlock, bool isModified = false) {
230228
if (analyzer->updateScope(endBlock, isModified)) {
231229
ForwardTraversal ft = *this;
232230
ft.analyzer->forkScope(endBlock);
233231
ft.updateRange(endBlock->link(), endBlock);
234232
return {ft};
235233
}
236-
return std::vector<ForwardTraversal>{};
234+
return std::vector<ForwardTraversal> {};
237235
}
238236

239237
static bool hasGoto(const Token* endBlock) {
@@ -270,8 +268,7 @@ struct ForwardTraversal {
270268
return a;
271269
}
272270

273-
void continueUpdateRangeAfterLoop(std::vector<ForwardTraversal>& ftv, Token* start, const Token* endToken)
274-
{
271+
void continueUpdateRangeAfterLoop(std::vector<ForwardTraversal>& ftv, Token* start, const Token* endToken) {
275272
for (ForwardTraversal& ft : ftv) {
276273
// If analysis has terminated normally, then continue analysis
277274
if (ft.terminate == Terminate::None)
@@ -283,8 +280,7 @@ struct ForwardTraversal {
283280
Token* endBlock,
284281
Token* condTok,
285282
Token* initTok = nullptr,
286-
Token* stepTok = nullptr)
287-
{
283+
Token* stepTok = nullptr) {
288284
const bool isDoWhile = precedes(endBlock, condTok);
289285
Analyzer::Action bodyAnalysis = analyzeScope(endBlock);
290286
Analyzer::Action allAnalysis = bodyAnalysis;

lib/programmemory.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
#include <limits>
1111
#include <memory>
1212

13-
void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value) { values[exprid] = value; }
13+
void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value)
14+
{
15+
values[exprid] = value;
16+
}
1417
const ValueFlow::Value* ProgramMemory::getValue(MathLib::bigint exprid) const
1518
{
1619
const ProgramMemory::Map::const_iterator it = values.find(exprid);
@@ -61,7 +64,10 @@ void ProgramMemory::setUnknown(MathLib::bigint exprid)
6164
values[exprid].valueType = ValueFlow::Value::ValueType::UNINIT;
6265
}
6366

64-
bool ProgramMemory::hasValue(MathLib::bigint exprid) { return values.find(exprid) != values.end(); }
67+
bool ProgramMemory::hasValue(MathLib::bigint exprid)
68+
{
69+
return values.find(exprid) != values.end();
70+
}
6571

6672
void ProgramMemory::swap(ProgramMemory &pm)
6773
{

lib/symboldatabase.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,9 @@ class CPPCHECKLIB SymbolDatabase {
13101310
return const_cast<Scope *>(this->findScope(tok, const_cast<const Scope *>(startScope)));
13111311
}
13121312

1313-
bool isVarId(nonneg int varid) const { return varid < mVariableList.size(); }
1313+
bool isVarId(nonneg int varid) const {
1314+
return varid < mVariableList.size();
1315+
}
13141316

13151317
const Variable *getVariableFromVarId(nonneg int varId) const {
13161318
return mVariableList.at(varId);

lib/token.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@ void Token::update_property_info()
128128
}
129129

130130
static const std::unordered_set<std::string> stdTypes = { "bool"
131-
, "_Bool"
132-
, "char"
133-
, "double"
134-
, "float"
135-
, "int"
136-
, "long"
137-
, "short"
138-
, "size_t"
139-
, "void"
140-
, "wchar_t"
141-
};
131+
, "_Bool"
132+
, "char"
133+
, "double"
134+
, "float"
135+
, "int"
136+
, "long"
137+
, "short"
138+
, "size_t"
139+
, "void"
140+
, "wchar_t"
141+
};
142142

143143
void Token::update_property_isStandardType()
144144
{

lib/tokenize.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void Tokenizer::simplifyUsingToTypedef()
563563
// using a::b; => typedef a::b b;
564564
if ((Token::Match(tok, "[;{}] using %name% :: %name% ::|;") && !tok->tokAt(2)->isKeyword()) ||
565565
(Token::Match(tok, "[;{}] using :: %name% :: %name% ::|;") && !tok->tokAt(3)->isKeyword())) {
566-
Token *endtok = tok->tokAt(5);
566+
Token *endtok = tok->tokAt(5);
567567
if (Token::Match(endtok, "%name%"))
568568
endtok = endtok->next();
569569
while (Token::Match(endtok, ":: %name%"))
@@ -3437,8 +3437,8 @@ void Tokenizer::setVarId()
34373437
#define NOTSTART_C "NOT", "case", "default", "goto", "not", "return", "sizeof", "typedef"
34383438
static const std::unordered_set<std::string> notstart_c = { NOTSTART_C };
34393439
static const std::unordered_set<std::string> notstart_cpp = { NOTSTART_C,
3440-
"delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template"
3441-
};
3440+
"delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template"
3441+
};
34423442

34433443
void Tokenizer::setVarIdPass1()
34443444
{
@@ -9824,15 +9824,15 @@ void Tokenizer::findGarbageCode() const
98249824

98259825
// Keywords in global scope
98269826
static const std::unordered_set<std::string> nonGlobalKeywords{"break",
9827-
"continue",
9828-
"for",
9829-
"goto",
9830-
"if",
9831-
"return",
9832-
"switch",
9833-
"while",
9834-
"try",
9835-
"catch"};
9827+
"continue",
9828+
"for",
9829+
"goto",
9830+
"if",
9831+
"return",
9832+
"switch",
9833+
"while",
9834+
"try",
9835+
"catch"};
98369836
for (const Token *tok = tokens(); tok; tok = tok->next()) {
98379837
if (tok->str() == "{")
98389838
tok = tok->link();

lib/valueflow.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ static bool bifurcateVariableChanged(const Variable* var,
17421742
bool result = false;
17431743
const Token* tok = start;
17441744
while ((tok = findVariableChanged(
1745-
tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) {
1745+
tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) {
17461746
if (Token::Match(tok->astParent(), "%assign%")) {
17471747
if (!bifurcate(tok->astParent()->astOperand2(), varids, settings, depth - 1))
17481748
return true;
@@ -2312,8 +2312,7 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer {
23122312
return unknown;
23132313
}
23142314

2315-
virtual ProgramState getProgramState() const OVERRIDE
2316-
{
2315+
virtual ProgramState getProgramState() const OVERRIDE {
23172316
ProgramState ps;
23182317
ps[expr->exprId()] = value;
23192318
return ps;

0 commit comments

Comments
 (0)