fixed some clang-tidy warnings (#3080)
This commit is contained in:
parent
eb9c4b4aed
commit
c71033548f
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-readability-misleading-indentation,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
|
|
|
@ -32,6 +32,7 @@ tools/extracttests
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
.vs/
|
.vs/
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
# VS build folders
|
# VS build folders
|
||||||
bin/
|
bin/
|
||||||
|
|
|
@ -34,7 +34,7 @@ static std::string unhandledElement(const QXmlStreamReader &xmlReader)
|
||||||
throw std::runtime_error(QObject::tr("line %1: Unhandled element %2").arg(xmlReader.lineNumber()).arg(xmlReader.name().toString()).toStdString());
|
throw std::runtime_error(QObject::tr("line %1: Unhandled element %2").arg(xmlReader.lineNumber()).arg(xmlReader.name().toString()).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string mandatoryAttibuteMissing(const QXmlStreamReader &xmlReader, QString attributeName)
|
static std::string mandatoryAttibuteMissing(const QXmlStreamReader &xmlReader, const QString& attributeName)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(QObject::tr("line %1: Mandatory attribute '%2' missing in '%3'")
|
throw std::runtime_error(QObject::tr("line %1: Mandatory attribute '%2' missing in '%3'")
|
||||||
.arg(xmlReader.lineNumber())
|
.arg(xmlReader.lineNumber())
|
||||||
|
|
|
@ -72,7 +72,7 @@ std::string Path::fromNativeSeparators(std::string path)
|
||||||
|
|
||||||
std::string Path::simplifyPath(std::string originalPath)
|
std::string Path::simplifyPath(std::string originalPath)
|
||||||
{
|
{
|
||||||
return simplecpp::simplifyPath(originalPath);
|
return simplecpp::simplifyPath(std::move(originalPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Path::getPathFromFilename(const std::string &filename)
|
std::string Path::getPathFromFilename(const std::string &filename)
|
||||||
|
|
|
@ -1310,20 +1310,20 @@ void SymbolDatabase::createSymbolDatabaseSetVariablePointers()
|
||||||
void SymbolDatabase::createSymbolDatabaseEnums()
|
void SymbolDatabase::createSymbolDatabaseEnums()
|
||||||
{
|
{
|
||||||
// fill in enumerators in enum
|
// fill in enumerators in enum
|
||||||
for (std::list<Scope>::iterator it = scopeList.begin(); it != scopeList.end(); ++it) {
|
for (Scope &scope : scopeList) {
|
||||||
if (it->type != Scope::eEnum)
|
if (scope.type != Scope::eEnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// add enumerators to enumerator tokens
|
// add enumerators to enumerator tokens
|
||||||
for (Enumerator & i : it->enumeratorList)
|
for (Enumerator & i : scope.enumeratorList)
|
||||||
const_cast<Token *>(i.name)->enumerator(&i);
|
const_cast<Token *>(i.name)->enumerator(&i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::list<Scope>::iterator it = scopeList.begin(); it != scopeList.end(); ++it) {
|
for (Scope &scope : scopeList) {
|
||||||
if (it->type != Scope::eEnum)
|
if (scope.type != Scope::eEnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Enumerator & enumerator : it->enumeratorList) {
|
for (Enumerator & enumerator : scope.enumeratorList) {
|
||||||
// look for initialization tokens that can be converted to enumerators and convert them
|
// look for initialization tokens that can be converted to enumerators and convert them
|
||||||
if (enumerator.start) {
|
if (enumerator.start) {
|
||||||
if (!enumerator.end)
|
if (!enumerator.end)
|
||||||
|
|
|
@ -211,7 +211,7 @@ void TokenList::deleteTokens(Token *tok)
|
||||||
// add a token.
|
// add a token.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void TokenList::addtoken(std::string str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split)
|
void TokenList::addtoken(const std::string& str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split)
|
||||||
{
|
{
|
||||||
if (str.empty())
|
if (str.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -244,7 +244,7 @@ void TokenList::addtoken(std::string str, const nonneg int lineno, const nonneg
|
||||||
mTokensFrontBack.back->fileIndex(fileno);
|
mTokensFrontBack.back->fileIndex(fileno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TokenList::addtoken(std::string str, const Token *locationTok)
|
void TokenList::addtoken(const std::string& str, const Token *locationTok)
|
||||||
{
|
{
|
||||||
if (str.empty())
|
if (str.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -70,8 +70,8 @@ public:
|
||||||
*/
|
*/
|
||||||
static void deleteTokens(Token *tok);
|
static void deleteTokens(Token *tok);
|
||||||
|
|
||||||
void addtoken(std::string str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split = false);
|
void addtoken(const std::string& str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split = false);
|
||||||
void addtoken(std::string str, const Token *locationTok);
|
void addtoken(const std::string& str, const Token *locationTok);
|
||||||
|
|
||||||
void addtoken(const Token *tok, const nonneg int lineno, const nonneg int column, const nonneg int fileno);
|
void addtoken(const Token *tok, const nonneg int lineno, const nonneg int column, const nonneg int fileno);
|
||||||
void addtoken(const Token *tok, const Token *locationTok);
|
void addtoken(const Token *tok, const Token *locationTok);
|
||||||
|
|
|
@ -1807,7 +1807,7 @@ static void valueFlowGlobalStaticVar(TokenList *tokenList, const Settings *setti
|
||||||
static Analyzer::Result valueFlowForward(Token* startToken,
|
static Analyzer::Result valueFlowForward(Token* startToken,
|
||||||
const Token* endToken,
|
const Token* endToken,
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
std::list<ValueFlow::Value> values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* const tokenlist,
|
TokenList* const tokenlist,
|
||||||
const Settings* settings);
|
const Settings* settings);
|
||||||
|
|
||||||
|
@ -1815,7 +1815,7 @@ static void valueFlowReverse(TokenList* tokenlist,
|
||||||
Token* tok,
|
Token* tok,
|
||||||
const Token* const varToken,
|
const Token* const varToken,
|
||||||
ValueFlow::Value val,
|
ValueFlow::Value val,
|
||||||
ValueFlow::Value val2,
|
const ValueFlow::Value& val2,
|
||||||
ErrorLogger* errorLogger,
|
ErrorLogger* errorLogger,
|
||||||
const Settings* settings);
|
const Settings* settings);
|
||||||
|
|
||||||
|
@ -3026,7 +3026,7 @@ ValuePtr<Analyzer> makeAnalyzer(const Token* exprTok, ValueFlow::Value value, co
|
||||||
static Analyzer::Result valueFlowForward(Token* startToken,
|
static Analyzer::Result valueFlowForward(Token* startToken,
|
||||||
const Token* endToken,
|
const Token* endToken,
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
std::list<ValueFlow::Value> values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* const tokenlist,
|
TokenList* const tokenlist,
|
||||||
const Settings* settings)
|
const Settings* settings)
|
||||||
{
|
{
|
||||||
|
@ -3067,7 +3067,7 @@ static void valueFlowReverse(TokenList* tokenlist,
|
||||||
Token* tok,
|
Token* tok,
|
||||||
const Token* const varToken,
|
const Token* const varToken,
|
||||||
ValueFlow::Value val,
|
ValueFlow::Value val,
|
||||||
ValueFlow::Value val2,
|
const ValueFlow::Value& val2,
|
||||||
ErrorLogger* /*errorLogger*/,
|
ErrorLogger* /*errorLogger*/,
|
||||||
const Settings* settings)
|
const Settings* settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,7 +147,7 @@ void MainWindow::refreshResults()
|
||||||
filter(ui->version->currentText());
|
filter(ui->version->currentText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::filter(QString filter)
|
void MainWindow::filter(const QString& filter)
|
||||||
{
|
{
|
||||||
QStringList allErrors;
|
QStringList allErrors;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void loadFile();
|
void loadFile();
|
||||||
void loadFromClipboard();
|
void loadFromClipboard();
|
||||||
void filter(QString filter);
|
void filter(const QString& filter);
|
||||||
void showResult(QListWidgetItem *item);
|
void showResult(QListWidgetItem *item);
|
||||||
void refreshResults();
|
void refreshResults();
|
||||||
void fileTreeFilter(const QString &str);
|
void fileTreeFilter(const QString &str);
|
||||||
|
|
Loading…
Reference in New Issue