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

Method memberVar1

test/testsymboldatabase.cpp:1782–1796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1780 }
1781
1782 void memberVar1() {
1783 GET_SYMBOL_DB("struct Foo {\n"
1784 " int x;\n"
1785 "};\n"
1786 "struct Bar : public Foo {};\n"
1787 "void f() {\n"
1788 " struct Bar bar;\n"
1789 " bar.x = 123;\n" // <- x should get a variable() pointer
1790 "}");
1791
1792 ASSERT(db != nullptr);
1793 const Token *tok = Token::findsimplematch(tokenizer.tokens(), "x =");
1794 ASSERT(tok->variable());
1795 ASSERT(Token::simpleMatch(tok->variable()->typeStartToken(), "int x ;"));
1796 }
1797
1798 void arrayMemberVar1() {
1799 GET_SYMBOL_DB("struct Foo {\n"

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
variableMethod · 0.80
simpleMatchFunction · 0.50

Tested by

no test coverage detected