Rename Verification => Bughunting

This commit is contained in:
Daniel Marjamäki 2020-01-18 07:25:39 +01:00
parent 103532bb03
commit f7a30fc99f
12 changed files with 20 additions and 20 deletions

View File

@ -1091,7 +1091,7 @@ void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
}
}
void CppCheckExecutor::reportVerification(const std::string &str)
void CppCheckExecutor::bughuntingReport(const std::string &str)
{
if (!mSettings || str.empty())
return;

View File

@ -81,7 +81,7 @@ public:
*/
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
void reportVerification(const std::string &str) OVERRIDE;
void bughuntingReport(const std::string &str) OVERRIDE;
/**
* Information about how many files have been checked

View File

@ -348,7 +348,7 @@ void ThreadExecutor::reportInfo(const ErrorLogger::ErrorMessage &msg)
writeToPipe(REPORT_INFO, msg.serialize());
}
void ThreadExecutor::reportVerification(const std::string &str)
void ThreadExecutor::bughuntingReport(const std::string &str)
{
writeToPipe(REPORT_VERIFICATION, str.c_str());
}

View File

@ -54,7 +54,7 @@ public:
void reportOut(const std::string &outmsg) OVERRIDE;
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
void reportVerification(const std::string &str) OVERRIDE;
void bughuntingReport(const std::string &str) OVERRIDE;
/**
* @brief Add content to a file, to be used in unit testing.

View File

@ -16,7 +16,7 @@ NewSuppressionDialog::NewSuppressionDialog(QWidget *parent) :
void reportErr(const ErrorLogger::ErrorMessage &msg) override {
errorIds << QString::fromStdString(msg.id);
}
void reportVerification(const std::string &/*str*/) override {}
void bughuntingReport(const std::string &/*str*/) override {}
QStringList errorIds;
};

View File

@ -74,7 +74,7 @@ public:
*/
void reportOut(const std::string &outmsg) override;
void reportErr(const ErrorLogger::ErrorMessage &msg) override;
void reportVerification(const std::string &/*str*/) override {}
void bughuntingReport(const std::string &/*str*/) override {}
public slots:

View File

@ -1286,9 +1286,9 @@ void CppCheck::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount
}
void CppCheck::reportVerification(const std::string &str)
void CppCheck::bughuntingReport(const std::string &str)
{
mErrorLogger.reportVerification(str);
mErrorLogger.bughuntingReport(str);
}
void CppCheck::getErrorMessages()

View File

@ -195,7 +195,7 @@ private:
*/
void reportOut(const std::string &outmsg) OVERRIDE;
void reportVerification(const std::string &str) OVERRIDE;
void bughuntingReport(const std::string &str) OVERRIDE;
std::list<std::string> mErrorList;
Settings mSettings;

View File

@ -407,7 +407,7 @@ public:
reportErr(msg);
}
virtual void reportVerification(const std::string &str) = 0;
virtual void bughuntingReport(const std::string &str) = 0;
/**
* Report unmatched suppressions

View File

@ -1794,7 +1794,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, const Tokenizer *to
}
}
// Write a verification report
// Write a report
if (bugHuntingReport) {
report << "[function-report] "
<< Path::stripDirectoryPart(tokenizer->list.getFiles().at(functionScope->bodyStart->fileIndex())) << ":"
@ -1827,7 +1827,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
if (tok->astParent()->astOperand2() == tok && value.isEqual(dataBase, 0)) {
dataBase->addError(tok->linenr());
std::list<const Token*> callstack{tok->astParent()};
const char * const id = (tok->valueType() && tok->valueType()->isFloat()) ? "verificationDivByZeroFloat" : "verificationDivByZero";
const char * const id = (tok->valueType() && tok->valueType()->isFloat()) ? "bughuntingDivByZeroFloat" : "bughuntingDivByZero";
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, id, "There is division, cannot determine that there can't be a division by zero.", CWE(369), false);
errorLogger->reportErr(errmsg);
}
@ -1877,7 +1877,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
errorMessage += " Note that unsigned integer overflow is defined and will wrap around.";
std::list<const Token*> callstack{tok};
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationIntegerOverflow", errorMessage, false);
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingIntegerOverflow", errorMessage, false);
errorLogger->reportErr(errmsg);
};
#endif
@ -1943,7 +1943,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
dataBase->addError(tok->linenr());
std::list<const Token*> callstack{tok};
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationUninit", "Cannot determine that '" + tok->expressionString() + "' is initialized", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingUninit", "Cannot determine that '" + tok->expressionString() + "' is initialized", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
errorLogger->reportErr(errmsg);
};
#endif
@ -1991,7 +1991,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
ErrorLogger::ErrorMessage errmsg(callstack,
&tokenizer->list,
Severity::SeverityType::error,
"verificationInvalidArgValue",
"bughuntingInvalidArgValue",
"There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value meets the attribute " + bad, CWE(0), false);
errorLogger->reportErr(errmsg);
return;
@ -2040,7 +2040,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
if (err) {
dataBase->addError(tok->linenr());
std::list<const Token*> callstack{tok};
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationInvalidArgValue", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value is valid. Bad value: " + bad, CWE(0), false);
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingInvalidArgValue", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value is valid. Bad value: " + bad, CWE(0), false);
errorLogger->reportErr(errmsg);
break;
}
@ -2055,7 +2055,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
if (v.second->isUninit()) {
dataBase->addError(tok->linenr());
std::list<const Token*> callstack{tok};
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationUninitArg", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument is initialized.", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingUninitArg", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument is initialized.", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
errorLogger->reportErr(errmsg);
break;
}
@ -2079,5 +2079,5 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
if (settings->bugHuntingReport.empty())
std::cout << report.str();
else if (errorLogger)
errorLogger->reportVerification(report.str());
errorLogger->bughuntingReport(report.str());
}

View File

@ -38,7 +38,7 @@ private:
std::list<std::string> id;
void reportOut(const std::string & /*outmsg*/) OVERRIDE {}
void reportVerification(const std::string & /*str*/) OVERRIDE {}
void bughuntingReport(const std::string & /*str*/) OVERRIDE {}
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE {
id.push_back(msg.id);

View File

@ -82,7 +82,7 @@ protected:
void processOptions(const options& args);
public:
void reportVerification(const std::string &/*str*/) OVERRIDE {}
void bughuntingReport(const std::string &/*str*/) OVERRIDE {}
void reportOut(const std::string &outmsg) OVERRIDE;
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
void run(const std::string &str);