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

Method findFunction21

test/testsymboldatabase.cpp:7915–7932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7913 }
7914
7915 void findFunction21() { // # 8558
7916 GET_SYMBOL_DB("struct foo {\n"
7917 " int GetThing( ) const { return m_thing; }\n"
7918 " int* GetThing( ) { return &m_thing; }\n"
7919 "};\n"
7920 "\n"
7921 "void f(foo *myFoo) {\n"
7922 " int* myThing = myFoo->GetThing();\n"
7923 "}");
7924
7925 ASSERT(db != nullptr);
7926
7927 const Token *tok1 = Token::findsimplematch(tokenizer.tokens(), "myFoo . GetThing ( ) ;");
7928
7929 const Function *f = tok1 && tok1->tokAt(2) ? tok1->tokAt(2)->function() : nullptr;
7930 ASSERT(f != nullptr);
7931 ASSERT_EQUALS(true, f && !f->isConst());
7932 }
7933
7934 void findFunction22() { // # 8558
7935 GET_SYMBOL_DB("struct foo {\n"

Callers

nothing calls this directly

Calls 4

findsimplematchFunction · 0.85
isConstMethod · 0.80
tokAtMethod · 0.45
functionMethod · 0.45

Tested by

no test coverage detected