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

Method ctu

test/testclass.cpp:9280–9301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9278
9279
9280 void ctu(const std::vector<std::string> &code) {
9281 CheckClass checkClass;
9282 Check &check = getCheck(checkClass);
9283
9284 // getFileInfo
9285 std::list<const Check::FileInfo*> fileInfo;
9286 for (const std::string& c: code) {
9287 const std::string filename = std::to_string(fileInfo.size()) + ".cpp";
9288 SimpleTokenizer tokenizer{settingsDefault, *this, filename};
9289 ASSERT(tokenizer.tokenize(c));
9290 fileInfo.push_back(check.getFileInfo(tokenizer, settingsDefault, ""));
9291 }
9292
9293 // Check code..
9294 const CTU::FileInfo ctu;
9295 check.analyseWholeProgram(ctu, fileInfo, settingsDefault, *this); // TODO: check result
9296
9297 while (!fileInfo.empty()) {
9298 delete fileInfo.back();
9299 fileInfo.pop_back();
9300 }
9301 }
9302
9303 void ctuOneDefinitionRule() {
9304 ctu({"class C { C() { std::cout << 0; } };", "class C { C() { std::cout << 1; } };"});

Callers

nothing calls this directly

Calls 6

tokenizeMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
getFileInfoMethod · 0.45
analyseWholeProgramMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected