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

Method functionArgs22

test/testsymboldatabase.cpp:3084–3098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3082 }
3083
3084 void functionArgs22() {
3085 const char code[] = "typedef void (*callback_fn)(void);\n"
3086 "void ext_func(const callback_fn cb, size_t v) {}\n";
3087 GET_SYMBOL_DB(code);
3088 ASSERT(db != nullptr);
3089 ASSERT_EQUALS(1U, db->functionScopes.size());
3090 const auto it = db->functionScopes.cbegin();
3091 const Function *func = (*it)->function;
3092 ASSERT_EQUALS("ext_func", func->name());
3093 ASSERT_EQUALS(2, func->argCount());
3094 const Variable *arg = func->getArgumentVar(0);
3095 ASSERT_EQUALS("cb", arg->name());
3096 arg = func->getArgumentVar(1);
3097 ASSERT_EQUALS("v", arg->name());
3098 }
3099
3100 void functionImplicitlyVirtual() {
3101 GET_SYMBOL_DB("class base { virtual void f(); };\n"

Callers

nothing calls this directly

Calls 3

getArgumentVarMethod · 0.80
sizeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected