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

Method findFunction8

test/testsymboldatabase.cpp:7418–7494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7416 }
7417
7418 void findFunction8() {
7419 GET_SYMBOL_DB("struct S {\n"
7420 " void f() { }\n"
7421 " void f() & { }\n"
7422 " void f() &&{ }\n"
7423 " void f() const { }\n"
7424 " void f() const & { }\n"
7425 " void f() const &&{ }\n"
7426 " void g() ;\n"
7427 " void g() & ;\n"
7428 " void g() &&;\n"
7429 " void g() const ;\n"
7430 " void g() const & ;\n"
7431 " void g() const &&;\n"
7432 "};\n"
7433 "void S::g() { }\n"
7434 "void S::g() & { }\n"
7435 "void S::g() &&{ }\n"
7436 "void S::g() const { }\n"
7437 "void S::g() const & { }\n"
7438 "void S::g() const &&{ }");
7439 ASSERT_EQUALS("", errout_str());
7440
7441 const Token *f = Token::findsimplematch(tokenizer.tokens(), "f ( ) {");
7442 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 2);
7443
7444 f = Token::findsimplematch(tokenizer.tokens(), "f ( ) & {");
7445 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 3);
7446
7447 f = Token::findsimplematch(tokenizer.tokens(), "f ( ) && {");
7448 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 4);
7449
7450 f = Token::findsimplematch(tokenizer.tokens(), "f ( ) const {");
7451 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);
7452
7453 f = Token::findsimplematch(tokenizer.tokens(), "f ( ) const & {");
7454 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 6);
7455
7456 f = Token::findsimplematch(tokenizer.tokens(), "f ( ) const && {");
7457 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 7);
7458
7459 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) {");
7460 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 8 && f->function()->token->linenr() == 15);
7461
7462 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) & {");
7463 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 9 && f->function()->token->linenr() == 16);
7464
7465 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) && {");
7466 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10 && f->function()->token->linenr() == 17);
7467
7468 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) const {");
7469 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 11 && f->function()->token->linenr() == 18);
7470
7471 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) const & {");
7472 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 12 && f->function()->token->linenr() == 19);
7473
7474 f = Token::findsimplematch(tokenizer.tokens(), "g ( ) const && {");
7475 ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 13 && f->function()->token->linenr() == 20);

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
functionMethod · 0.45
tokAtMethod · 0.45

Tested by

no test coverage detected