Skip to content

Commit d6663e4

Browse files
committed
Format
1 parent b6f4da1 commit d6663e4

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5861,7 +5861,10 @@ bool Scope::hasInlineOrLambdaFunction(const Token** tokStart, bool onlyInline) c
58615861
});
58625862
}
58635863

5864-
void Scope::findFunctionInBase(const std::string& name, const Token* tok, size_t args, std::vector<const Function *> & matches) const
5864+
void Scope::findFunctionInBase(const std::string& name,
5865+
const Token* tok,
5866+
size_t args,
5867+
std::vector<const Function*>& matches) const
58655868
{
58665869
if (isClassOrStruct() && definedType && !definedType->derivedFrom.empty()) {
58675870
const std::vector<Type::BaseInfo> &derivedFrom = definedType->derivedFrom;
@@ -6021,9 +6024,9 @@ static bool hasMatchingConstructor(const Scope* classScope, const ValueType* arg
60216024
});
60226025
}
60236026

6024-
const Function* Scope::findFunction(const Token *tok, bool requireConst, Reference ref, const std::string &funcName) const
6027+
const Function* Scope::findFunction(const Token* tok, bool requireConst, Reference ref, const std::string& funcName) const
60256028
{
6026-
const std::string &name = funcName.empty() ? tok->str() : funcName;
6029+
const std::string& name = funcName.empty() ? tok->str() : funcName;
60276030

60286031
const bool isCall = Token::Match(tok->next(), "(|{");
60296032

@@ -6034,7 +6037,7 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst, Referen
60346037
// find all the possible functions that could match
60356038
const std::size_t args = arguments.size();
60366039

6037-
auto addMatchingFunctions = [&](const Scope *scope) {
6040+
auto addMatchingFunctions = [&](const Scope* scope) {
60386041
auto range = scope->functionMap.equal_range(name);
60396042
for (auto it = range.first; it != range.second; ++it) {
60406043
const Function *func = it->second;
@@ -7796,7 +7799,8 @@ static const Function* getFunction(const Token* tok) {
77967799
return lambda;
77977800
// calling an object of a class that overloads operator()
77987801
if (tok != lvar->nameToken() && !lvar->isPointer() && !lvar->isArray() && lvar->typeScope()) {
7799-
const Function* callOp = lvar->typeScope()->findFunction(tok, lvar->isConst(), Reference::LValue, "operator()");
7802+
const Function* callOp =
7803+
lvar->typeScope()->findFunction(tok, lvar->isConst(), Reference::LValue, "operator()");
78007804
if (callOp && callOp->retDef)
78017805
return callOp;
78027806
}

lib/symboldatabase.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,10 @@ class CPPCHECKLIB Scope {
11481148
* @param funcName name to look up instead of tok->str(), e.g. "operator()" when tok is a variable that is called
11491149
* @return pointer to function if found or NULL if not found
11501150
*/
1151-
const Function *findFunction(const Token *tok, bool requireConst=false, Reference ref=Reference::None, const std::string &funcName = "") const;
1151+
const Function* findFunction(const Token* tok,
1152+
bool requireConst = false,
1153+
Reference ref = Reference::None,
1154+
const std::string& funcName = "") const;
11521155

11531156
const Scope *findRecordInNestedList(const std::string & name, bool isC = false) const;
11541157
Scope *findRecordInNestedList(const std::string & name, bool isC = false);
@@ -1212,7 +1215,10 @@ class CPPCHECKLIB Scope {
12121215
*/
12131216
bool isVariableDeclaration(const Token* tok, const Token*& vartok, const Token*& typetok) const;
12141217

1215-
void findFunctionInBase(const std::string& name, const Token* tok, size_t args, std::vector<const Function *> & matches) const;
1218+
void findFunctionInBase(const std::string& name,
1219+
const Token* tok,
1220+
size_t args,
1221+
std::vector<const Function*>& matches) const;
12161222

12171223
/** @brief initialize varlist */
12181224
void getVariableList(const Token *start, const Token *end);

test/testnullpointer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,8 @@ class TestNullPointer : public TestFixture {
31293129
ASSERT_EQUALS("", errout_str());
31303130
}
31313131

3132-
void nullpointer110() { // #14937 - noreturn member function called on operator() result
3132+
void nullpointer110()
3133+
{ // #14937 - noreturn member function called on operator() result
31333134
check("struct A {\n"
31343135
" [[noreturn]] void g(int);\n"
31353136
"};\n"
@@ -3141,7 +3142,8 @@ class TestNullPointer : public TestFixture {
31413142
" if (!p)\n"
31423143
" thunk().g(0);\n"
31433144
" *p = 1;\n"
3144-
"}", dinit(CheckOptions, $.inconclusive = true));
3145+
"}",
3146+
dinit(CheckOptions, $.inconclusive = true));
31453147
ASSERT_EQUALS("", errout_str());
31463148
}
31473149

test/testsymboldatabase.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8877,7 +8877,8 @@ class TestSymbolDatabase : public TestFixture {
88778877
ASSERT_EQUALS(2, functionCall->function()->token->linenr());
88788878
}
88798879

8880-
void findFunction63() { // #14937
8880+
void findFunction63()
8881+
{ // #14937
88818882
GET_SYMBOL_DB("struct A {\n"
88828883
" void g(int);\n"
88838884
"};\n"
@@ -8899,7 +8900,8 @@ class TestSymbolDatabase : public TestFixture {
88998900
ASSERT_EQUALS(static_cast<int>(Reference::LValue), static_cast<int>(call->valueType()->reference));
89008901
}
89018902

8902-
void findFunction64() { // overloaded operator()
8903+
void findFunction64()
8904+
{ // overloaded operator()
89038905
{
89048906
GET_SYMBOL_DB("struct A { void g(int); };\n" // overloads distinguished by argument count
89058907
"struct B { void h(int); };\n"

0 commit comments

Comments
 (0)