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

Function createDumpFile

lib/cppcheck.cpp:358–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358static void createDumpFile(const Settings& settings,
359 const FileWithDetails& file,
360 std::ofstream& fdump,
361 std::string& dumpFile)
362{
363 if (!settings.dump && settings.addons.empty())
364 return;
365 dumpFile = getDumpFileName(settings, file);
366
367 fdump.open(dumpFile);
368 if (!fdump.is_open())
369 return;
370
371 if (!settings.buildDir.empty()) {
372 std::ofstream fout(getCtuInfoFileName(dumpFile));
373 }
374
375 std::string language;
376
377 assert(file.lang() != Standards::Language::None);
378
379 switch (file.lang()) {
380 case Standards::Language::C:
381 language = " language=\"c\"";
382 break;
383 case Standards::Language::CPP:
384 language = " language=\"cpp\"";
385 break;
386 case Standards::Language::None:
387 break;
388 }
389
390 fdump << "<?xml version=\"1.0\"?>\n";
391 fdump << "<dumps" << language << ">\n";
392 fdump << " <platform"
393 << " name=\"" << settings.platform.toString() << '\"'
394 << " char_bit=\"" << static_cast<unsigned>(settings.platform.char_bit) << '\"'
395 << " short_bit=\"" << static_cast<unsigned>(settings.platform.short_bit) << '\"'
396 << " int_bit=\"" << static_cast<unsigned>(settings.platform.int_bit) << '\"'
397 << " long_bit=\"" << static_cast<unsigned>(settings.platform.long_bit) << '\"'
398 << " long_long_bit=\"" << static_cast<unsigned>(settings.platform.long_long_bit) << '\"'
399 << " float_bit=\"" << static_cast<unsigned>(settings.platform.float_bit) << '\"'
400 << " double_bit=\"" << static_cast<unsigned>(settings.platform.double_bit) << '\"'
401 << " long_double_bit=\"" << static_cast<unsigned>(settings.platform.long_double_bit) << '\"'
402 << " pointer_bit=\"" << (settings.platform.sizeof_pointer * settings.platform.char_bit) << '\"'
403 << " wchar_t_bit=\"" << (settings.platform.sizeof_wchar_t * settings.platform.char_bit) << '\"'
404 << " size_t_bit=\"" << (settings.platform.sizeof_size_t * settings.platform.char_bit) << '\"'
405 << "/>\n";
406}
407
408static std::string detectPython(const CppCheck::ExecuteCmdFn &executeCommand)
409{

Callers 2

checkClangMethod · 0.85
checkInternalMethod · 0.85

Calls 6

getDumpFileNameFunction · 0.85
getCtuInfoFileNameFunction · 0.85
langMethod · 0.80
emptyMethod · 0.45
openMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected