MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / findFunction7

Method findFunction7

test/testsymboldatabase.cpp:7399–7416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7397 }
7398
7399 void findFunction7() {
7400 GET_SYMBOL_DB("class ResultEnsemble {\n"
7401 "public:\n"
7402 " std::vector<int> &nodeResults() const;\n"
7403 " std::vector<int> &nodeResults();\n"
7404 "};\n"
7405 "class Simulator {\n"
7406 " int generatePinchResultEnsemble(const ResultEnsemble &power, const ResultEnsemble &ground) {\n"
7407 " power.nodeResults().size();\n"
7408 " assert(power.nodeResults().size()==ground.nodeResults().size());\n"
7409 " }\n"
7410 "};");
7411 const Token *callfunc = Token::findsimplematch(tokenizer.tokens(), "power . nodeResults ( ) . size ( ) ;");
7412 ASSERT_EQUALS("", errout_str());
7413 ASSERT_EQUALS(true, db != nullptr); // not null
7414 ASSERT_EQUALS(true, callfunc != nullptr); // not null
7415 ASSERT_EQUALS(true, callfunc && callfunc->tokAt(2)->function() && callfunc->tokAt(2)->function()->tokenDef->linenr() == 3);
7416 }
7417
7418 void findFunction8() {
7419 GET_SYMBOL_DB("struct S {\n"

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
functionMethod · 0.45
tokAtMethod · 0.45

Tested by

no test coverage detected