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

Method findFunction3

test/testsymboldatabase.cpp:7208–7221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7206 }
7207
7208 void findFunction3() {
7209 GET_SYMBOL_DB("struct base { void foo() { } };\n"
7210 "struct derived : public base { void foo() { } };\n"
7211 "void foo() {\n"
7212 " derived d;\n"
7213 " d.foo();\n"
7214 "}");
7215
7216 const Token *callfunc = Token::findsimplematch(tokenizer.tokens(), "d . foo ( ) ;");
7217 ASSERT_EQUALS("", errout_str());
7218 ASSERT_EQUALS(true, db != nullptr); // not null
7219 ASSERT_EQUALS(true, callfunc != nullptr); // not null
7220 ASSERT_EQUALS(true, callfunc && callfunc->tokAt(2)->function() && callfunc->tokAt(2)->function()->tokenDef->linenr() == 2); // should find function on line 2
7221 }
7222
7223 void findFunction4() {
7224 GET_SYMBOL_DB("void foo(UNKNOWN) { }\n"

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
functionMethod · 0.45
tokAtMethod · 0.45

Tested by

no test coverage detected