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

Method calculateHash

lib/cppcheck.cpp:860–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

858}
859
860std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const std::string& filePath) const
861{
862 std::ostringstream toolinfo;
863 toolinfo << (mSettings.cppcheckCfgProductName.empty() ? CPPCHECK_VERSION_STRING : mSettings.cppcheckCfgProductName);
864 toolinfo << (mSettings.severity.isEnabled(Severity::warning) ? 'w' : ' ');
865 toolinfo << (mSettings.severity.isEnabled(Severity::style) ? 's' : ' ');
866 toolinfo << (mSettings.severity.isEnabled(Severity::performance) ? 'p' : ' ');
867 toolinfo << (mSettings.severity.isEnabled(Severity::portability) ? 'p' : ' ');
868 toolinfo << (mSettings.severity.isEnabled(Severity::information) ? 'i' : ' ');
869 toolinfo << mSettings.userDefines;
870 toolinfo << (mSettings.checkConfiguration ? 'c' : ' '); // --check-config
871 toolinfo << (mSettings.force ? 'f' : ' ');
872 toolinfo << mSettings.maxConfigsOption;
873 toolinfo << std::to_string(static_cast<std::uint8_t>(mSettings.checkLevel));
874 for (const auto &a : mSettings.addonInfos) {
875 toolinfo << a.name;
876 toolinfo << a.args;
877 }
878 toolinfo << mSettings.premiumArgs;
879 // TODO: do we need to add more options?
880 mSuppressions.nomsg.dump(toolinfo, filePath);
881 return preprocessor.calculateHash(toolinfo.str());
882}
883
884unsigned int CppCheck::checkBuffer(const FileWithDetails &file, const std::string &cfgname, const char* data, std::size_t size)
885{

Callers 3

checkInternalMethod · 0.45
getHashMethod · 0.45
premiumResultsCacheMethod · 0.45

Calls 4

emptyMethod · 0.45
isEnabledMethod · 0.45
dumpMethod · 0.45
strMethod · 0.45

Tested by 2

getHashMethod · 0.36
premiumResultsCacheMethod · 0.36