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

Method functionArgs13

test/testsymboldatabase.cpp:2920–2946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2918 }
2919
2920 void functionArgs13() { // #7697
2921 GET_SYMBOL_DB("struct A {\n"
2922 " enum E { };\n"
2923 " struct S { };\n"
2924 "};\n"
2925 "struct B : public A {\n"
2926 " B(E e);\n"
2927 " B(S s);\n"
2928 "};\n"
2929 "B::B(A::E e) { }\n"
2930 "B::B(A::S s) { }");
2931
2932 ASSERT_EQUALS(true, db != nullptr);
2933 const Token *f = Token::findsimplematch(tokenizer.tokens(), "B ( A :: E");
2934 ASSERT_EQUALS(true, f && f->function());
2935 const Function *func = f->function();
2936 ASSERT_EQUALS(true, func->argumentList.size() == 1 && func->argumentList.front().type());
2937 const Type * type = func->argumentList.front().type();
2938 ASSERT_EQUALS(true, type->isEnumType() && type->name() == "E");
2939
2940 f = Token::findsimplematch(tokenizer.tokens(), "B ( A :: S");
2941 ASSERT_EQUALS(true, f && f->function());
2942 const Function *func2 = f->function();
2943 ASSERT_EQUALS(true, func2->argumentList.size() == 1 && func2->argumentList.front().type());
2944 const Type * type2 = func2->argumentList.front().type();
2945 ASSERT_EQUALS(true, type2->isStructType() && type2->name() == "S");
2946 }
2947
2948 void functionArgs14() { // #7697
2949 GET_SYMBOL_DB("void f(int (&a)[10], int (&b)[10]);");

Callers

nothing calls this directly

Calls 8

findsimplematchFunction · 0.85
typeMethod · 0.80
frontMethod · 0.80
isEnumTypeMethod · 0.80
isStructTypeMethod · 0.80
functionMethod · 0.45
sizeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected