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

Method findFunction23

test/testsymboldatabase.cpp:7953–7970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7951 }
7952
7953 void findFunction23() { // # 8558
7954 GET_SYMBOL_DB("struct foo {\n"
7955 " int GetThing( ) const { return m_thing; }\n"
7956 " int* GetThing( ) { return &m_thing; }\n"
7957 "};\n"
7958 "\n"
7959 "void f(foo *myFoo) {\n"
7960 " int* myThing = ((const foo *)myFoo)->GetThing();\n"
7961 "}");
7962
7963 ASSERT(db != nullptr);
7964
7965 const Token *tok1 = Token::findsimplematch(tokenizer.tokens(), ". GetThing ( ) ;")->next();
7966
7967 const Function *f = tok1 ? tok1->function() : nullptr;
7968 ASSERT(f != nullptr);
7969 ASSERT_EQUALS(true, f && f->isConst());
7970 }
7971
7972 void findFunction24() { // smart pointers
7973 GET_SYMBOL_DB("struct foo {\n"

Callers

nothing calls this directly

Calls 4

findsimplematchFunction · 0.85
nextMethod · 0.80
isConstMethod · 0.80
functionMethod · 0.45

Tested by

no test coverage detected