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

Method open

test/testmemleak.cpp:80–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 void open() {
81 const char code[] = "class A {\n"
82 " static int open() {\n"
83 " return 1;\n"
84 " }\n"
85 "\n"
86 " A() {\n"
87 " int ret = open();\n"
88 " }\n"
89 "};\n";
90
91 SimpleTokenizer tokenizer(settingsDefault, *this);
92 ASSERT(tokenizer.tokenize(code));
93
94 // there is no allocation
95 const Token *tok = Token::findsimplematch(tokenizer.tokens(), "ret =");
96 const CheckMemoryLeakImpl check(&tokenizer, settingsDefault, *this);
97 ASSERT_EQUALS(CheckMemoryLeakImpl::No, check.getAllocationType(tok->tokAt(2), 1));
98 }
99};
100
101REGISTER_TEST(TestMemleak)

Callers 13

unpack_packageFunction · 0.45
man_searchFunction · 0.45
convertFileMethod · 0.45
loadFileMethod · 0.45
showSrcFileMethod · 0.45
findInFilesClickedMethod · 0.45

Calls 4

findsimplematchFunction · 0.85
tokenizeMethod · 0.80
getAllocationTypeMethod · 0.45
tokAtMethod · 0.45

Tested by

no test coverage detected