enabled and fixed `modernize-pass-by-value` clang-tidy warnings (#4169)
This commit is contained in:
parent
304e448749
commit
b65b47d3a8
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-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-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-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,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness'
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-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,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-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,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness'
|
||||
WarningsAsErrors: '*'
|
||||
CheckOptions:
|
||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "application.h"
|
||||
|
||||
Application::Application(const QString &name, const QString &path,
|
||||
const QString ¶ms)
|
||||
: mName(name)
|
||||
, mPath(path)
|
||||
, mParameters(params)
|
||||
Application::Application(QString name, QString path,
|
||||
QString params)
|
||||
: mName(std::move(name))
|
||||
, mPath(std::move(path))
|
||||
, mParameters(std::move(params))
|
||||
{}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
class Application {
|
||||
public:
|
||||
Application() {}
|
||||
Application(const QString &name, const QString &path, const QString ¶ms);
|
||||
Application(QString name, QString path, QString params);
|
||||
|
||||
/**
|
||||
* @brief Get application name.
|
||||
|
|
|
@ -19,33 +19,42 @@
|
|||
#include "codeeditorstyle.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <utility>
|
||||
|
||||
CodeEditorStyle::CodeEditorStyle(
|
||||
const QColor& CtrlFGColor, const QColor& CtrlBGColor,
|
||||
const QColor& HiLiBGColor,
|
||||
const QColor& LnNumFGColor, const QColor& LnNumBGColor,
|
||||
const QColor& KeyWdFGColor, const QFont::Weight& KeyWdWeight,
|
||||
const QColor& ClsFGColor, const QFont::Weight& ClsWeight,
|
||||
const QColor& QteFGColor, const QFont::Weight& QteWeight,
|
||||
const QColor& CmtFGColor, const QFont::Weight& CmtWeight,
|
||||
const QColor& SymbFGColor, const QColor& SymbBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor CtrlFGColor, QColor CtrlBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor HiLiBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor LnNumFGColor, QColor LnNumBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor KeyWdFGColor, const QFont::Weight& KeyWdWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor ClsFGColor, const QFont::Weight& ClsWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor QteFGColor, const QFont::Weight& QteWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor CmtFGColor, const QFont::Weight& CmtWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor SymbFGColor, QColor SymbBGColor,
|
||||
const QFont::Weight& SymbWeight) :
|
||||
mSystemTheme(false),
|
||||
widgetFGColor(CtrlFGColor),
|
||||
widgetBGColor(CtrlBGColor),
|
||||
highlightBGColor(HiLiBGColor),
|
||||
lineNumFGColor(LnNumFGColor),
|
||||
lineNumBGColor(LnNumBGColor),
|
||||
keywordColor(KeyWdFGColor),
|
||||
widgetFGColor(std::move(CtrlFGColor)),
|
||||
widgetBGColor(std::move(CtrlBGColor)),
|
||||
highlightBGColor(std::move(HiLiBGColor)),
|
||||
lineNumFGColor(std::move(LnNumFGColor)),
|
||||
lineNumBGColor(std::move(LnNumBGColor)),
|
||||
keywordColor(std::move(KeyWdFGColor)),
|
||||
keywordWeight(KeyWdWeight),
|
||||
classColor(ClsFGColor),
|
||||
classColor(std::move(ClsFGColor)),
|
||||
classWeight(ClsWeight),
|
||||
quoteColor(QteFGColor),
|
||||
quoteColor(std::move(QteFGColor)),
|
||||
quoteWeight(QteWeight),
|
||||
commentColor(CmtFGColor),
|
||||
commentColor(std::move(CmtFGColor)),
|
||||
commentWeight(CmtWeight),
|
||||
symbolFGColor(SymbFGColor),
|
||||
symbolBGColor(SymbBGColor),
|
||||
symbolFGColor(std::move(SymbFGColor)),
|
||||
symbolBGColor(std::move(SymbBGColor)),
|
||||
symbolWeight(SymbWeight)
|
||||
{}
|
||||
|
||||
|
|
|
@ -50,14 +50,22 @@ class QSettings;
|
|||
class CodeEditorStyle {
|
||||
public:
|
||||
explicit CodeEditorStyle(
|
||||
const QColor& CtrlFGColor, const QColor& CtrlBGColor,
|
||||
const QColor& HiLiBGColor,
|
||||
const QColor& LnNumFGColor, const QColor& LnNumBGColor,
|
||||
const QColor& KeyWdFGColor, const QFont::Weight& KeyWdWeight,
|
||||
const QColor& ClsFGColor, const QFont::Weight& ClsWeight,
|
||||
const QColor& QteFGColor, const QFont::Weight& QteWeight,
|
||||
const QColor& CmtFGColor, const QFont::Weight& CmtWeight,
|
||||
const QColor& SymbFGColor, const QColor& SymbBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor CtrlFGColor, QColor CtrlBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor HiLiBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor LnNumFGColor, QColor LnNumBGColor,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor KeyWdFGColor, const QFont::Weight& KeyWdWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor ClsFGColor, const QFont::Weight& ClsWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor QteFGColor, const QFont::Weight& QteWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor CmtFGColor, const QFont::Weight& CmtWeight,
|
||||
// cppcheck-suppress naming-varname - TODO: fix this
|
||||
QColor SymbFGColor, QColor SymbBGColor,
|
||||
const QFont::Weight& SymbWeight);
|
||||
~CodeEditorStyle() {}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ ProjectFile::ProjectFile(QObject *parent) :
|
|||
clear();
|
||||
}
|
||||
|
||||
ProjectFile::ProjectFile(const QString &filename, QObject *parent) :
|
||||
ProjectFile::ProjectFile(QString filename, QObject *parent) :
|
||||
QObject(parent),
|
||||
mFilename(filename)
|
||||
mFilename(std::move(filename))
|
||||
{
|
||||
clear();
|
||||
read();
|
||||
|
|
|
@ -46,7 +46,7 @@ class ProjectFile : public QObject {
|
|||
|
||||
public:
|
||||
explicit ProjectFile(QObject *parent = nullptr);
|
||||
explicit ProjectFile(const QString &filename, QObject *parent = nullptr);
|
||||
explicit ProjectFile(QString filename, QObject *parent = nullptr);
|
||||
~ProjectFile() override {
|
||||
if (this == mActiveProject) mActiveProject = nullptr;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "report.h"
|
||||
|
||||
Report::Report(const QString &filename) :
|
||||
Report::Report(QString filename) :
|
||||
QObject(),
|
||||
mFilename(filename)
|
||||
mFilename(std::move(filename))
|
||||
{}
|
||||
|
||||
Report::~Report()
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
CSV,
|
||||
};
|
||||
|
||||
explicit Report(const QString &filename);
|
||||
explicit Report(QString filename);
|
||||
~Report() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -393,7 +393,7 @@ std::string CheckUnusedFunctions::analyzerInfo() const
|
|||
namespace {
|
||||
struct Location {
|
||||
Location() : lineNumber(0) {}
|
||||
Location(const std::string &f, const int l) : fileName(f), lineNumber(l) {}
|
||||
Location(std::string f, const int l) : fileName(std::move(f)), lineNumber(l) {}
|
||||
std::string fileName;
|
||||
int lineNumber;
|
||||
};
|
||||
|
|
|
@ -317,8 +317,8 @@ namespace clangimport {
|
|||
|
||||
class AstNode {
|
||||
public:
|
||||
AstNode(const std::string &nodeType, const std::string &ext, Data *data)
|
||||
: nodeType(nodeType), mExtTokens(splitString(ext)), mData(data)
|
||||
AstNode(std::string nodeType, const std::string &ext, Data *data)
|
||||
: nodeType(std::move(nodeType)), mExtTokens(splitString(ext)), mData(data)
|
||||
{}
|
||||
std::string nodeType;
|
||||
std::vector<AstNodePtr> children;
|
||||
|
|
|
@ -351,7 +351,7 @@ CppCheck::CppCheck(ErrorLogger &errorLogger,
|
|||
, mUseGlobalSuppressions(useGlobalSuppressions)
|
||||
, mTooManyConfigs(false)
|
||||
, mSimplify(true)
|
||||
, mExecuteCommand(executeCommand)
|
||||
, mExecuteCommand(std::move(executeCommand))
|
||||
{}
|
||||
|
||||
CppCheck::~CppCheck()
|
||||
|
|
|
@ -34,41 +34,18 @@
|
|||
#include <iomanip>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
InternalError::InternalError(const Token *tok, const std::string &errorMsg, Type type) :
|
||||
token(tok), errorMessage(errorMsg), type(type)
|
||||
{
|
||||
switch (type) {
|
||||
case AST:
|
||||
id = "internalAstError";
|
||||
break;
|
||||
case SYNTAX:
|
||||
id = "syntaxError";
|
||||
break;
|
||||
case UNKNOWN_MACRO:
|
||||
id = "unknownMacro";
|
||||
break;
|
||||
case INTERNAL:
|
||||
id = "cppcheckError";
|
||||
break;
|
||||
case LIMIT:
|
||||
id = "cppcheckLimit";
|
||||
break;
|
||||
case INSTANTIATION:
|
||||
id = "instantiationError";
|
||||
break;
|
||||
}
|
||||
}
|
||||
ErrorMessage::ErrorMessage()
|
||||
: incomplete(false), severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0)
|
||||
{}
|
||||
|
||||
ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, Certainty::CertaintyLevel certainty) :
|
||||
callStack(callStack), // locations for this error message
|
||||
id(id), // set the message id
|
||||
file0(file1),
|
||||
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, Certainty::CertaintyLevel certainty) :
|
||||
callStack(std::move(callStack)), // locations for this error message
|
||||
id(std::move(id)), // set the message id
|
||||
file0(std::move(file1)),
|
||||
incomplete(false),
|
||||
severity(severity), // severity for this error message
|
||||
cwe(0U),
|
||||
|
@ -81,10 +58,10 @@ ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::
|
|||
|
||||
|
||||
|
||||
ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::string& file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, Certainty::CertaintyLevel certainty) :
|
||||
callStack(callStack), // locations for this error message
|
||||
id(id), // set the message id
|
||||
file0(file1),
|
||||
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, const CWE &cwe, Certainty::CertaintyLevel certainty) :
|
||||
callStack(std::move(callStack)), // locations for this error message
|
||||
id(std::move(id)), // set the message id
|
||||
file0(std::move(file1)),
|
||||
incomplete(false),
|
||||
severity(severity), // severity for this error message
|
||||
cwe(cwe.id),
|
||||
|
@ -95,8 +72,8 @@ ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::
|
|||
setmsg(msg);
|
||||
}
|
||||
|
||||
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, Certainty::CertaintyLevel certainty)
|
||||
: id(id), incomplete(false), severity(severity), cwe(0U), certainty(certainty), hash(0)
|
||||
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, std::string id, const std::string& msg, Certainty::CertaintyLevel certainty)
|
||||
: id(std::move(id)), incomplete(false), severity(severity), cwe(0U), certainty(certainty), hash(0)
|
||||
{
|
||||
// Format callstack
|
||||
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {
|
||||
|
@ -114,8 +91,8 @@ ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const Token
|
|||
}
|
||||
|
||||
|
||||
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, const CWE &cwe, Certainty::CertaintyLevel certainty)
|
||||
: id(id), incomplete(false), severity(severity), cwe(cwe.id), certainty(certainty)
|
||||
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, std::string id, const std::string& msg, const CWE &cwe, Certainty::CertaintyLevel certainty)
|
||||
: id(std::move(id)), incomplete(false), severity(severity), cwe(cwe.id), certainty(certainty)
|
||||
{
|
||||
// Format callstack
|
||||
for (const Token *tok: callstack) {
|
||||
|
@ -651,8 +628,8 @@ ErrorMessage::FileLocation::FileLocation(const Token* tok, const TokenList* toke
|
|||
: fileIndex(tok->fileIndex()), line(tok->linenr()), column(tok->column()), mOrigFileName(tokenList->getOrigFile(tok)), mFileName(tokenList->file(tok))
|
||||
{}
|
||||
|
||||
ErrorMessage::FileLocation::FileLocation(const Token* tok, const std::string &info, const TokenList* tokenList)
|
||||
: fileIndex(tok->fileIndex()), line(tok->linenr()), column(tok->column()), mOrigFileName(tokenList->getOrigFile(tok)), mFileName(tokenList->file(tok)), mInfo(info)
|
||||
ErrorMessage::FileLocation::FileLocation(const Token* tok, std::string info, const TokenList* tokenList)
|
||||
: fileIndex(tok->fileIndex()), line(tok->linenr()), column(tok->column()), mOrigFileName(tokenList->getOrigFile(tok)), mFileName(tokenList->file(tok)), mInfo(std::move(info))
|
||||
{}
|
||||
|
||||
std::string ErrorMessage::FileLocation::getfile(bool convert) const
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
: fileIndex(0), line(line), column(column), mOrigFileName(file), mFileName(file), mInfo(info) {}
|
||||
|
||||
FileLocation(const Token* tok, const TokenList* tokenList);
|
||||
FileLocation(const Token* tok, const std::string &info, const TokenList* tokenList);
|
||||
FileLocation(const Token* tok, std::string info, const TokenList* tokenList);
|
||||
|
||||
/**
|
||||
* Return the filename.
|
||||
|
@ -120,28 +120,28 @@ public:
|
|||
std::string mInfo;
|
||||
};
|
||||
|
||||
ErrorMessage(const std::list<FileLocation> &callStack,
|
||||
const std::string& file1,
|
||||
ErrorMessage(std::list<FileLocation> callStack,
|
||||
std::string file1,
|
||||
Severity::SeverityType severity,
|
||||
const std::string &msg,
|
||||
const std::string &id, Certainty::CertaintyLevel certainty);
|
||||
ErrorMessage(const std::list<FileLocation> &callStack,
|
||||
const std::string& file1,
|
||||
std::string id, Certainty::CertaintyLevel certainty);
|
||||
ErrorMessage(std::list<FileLocation> callStack,
|
||||
std::string file1,
|
||||
Severity::SeverityType severity,
|
||||
const std::string &msg,
|
||||
const std::string &id,
|
||||
std::string id,
|
||||
const CWE &cwe,
|
||||
Certainty::CertaintyLevel certainty);
|
||||
ErrorMessage(const std::list<const Token*>& callstack,
|
||||
const TokenList* list,
|
||||
Severity::SeverityType severity,
|
||||
const std::string& id,
|
||||
std::string id,
|
||||
const std::string& msg,
|
||||
Certainty::CertaintyLevel certainty);
|
||||
ErrorMessage(const std::list<const Token*>& callstack,
|
||||
const TokenList* list,
|
||||
Severity::SeverityType severity,
|
||||
const std::string& id,
|
||||
std::string id,
|
||||
const std::string& msg,
|
||||
const CWE &cwe,
|
||||
Certainty::CertaintyLevel certainty);
|
||||
|
|
|
@ -18,6 +18,31 @@
|
|||
|
||||
#include "errortypes.h"
|
||||
|
||||
InternalError::InternalError(const Token *tok, std::string errorMsg, Type type) :
|
||||
token(tok), errorMessage(std::move(errorMsg)), type(type)
|
||||
{
|
||||
switch (type) {
|
||||
case AST:
|
||||
id = "internalAstError";
|
||||
break;
|
||||
case SYNTAX:
|
||||
id = "syntaxError";
|
||||
break;
|
||||
case UNKNOWN_MACRO:
|
||||
id = "unknownMacro";
|
||||
break;
|
||||
case INTERNAL:
|
||||
id = "cppcheckError";
|
||||
break;
|
||||
case LIMIT:
|
||||
id = "cppcheckLimit";
|
||||
break;
|
||||
case INSTANTIATION:
|
||||
id = "instantiationError";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Severity::toString(Severity::SeverityType severity)
|
||||
{
|
||||
switch (severity) {
|
||||
|
|
|
@ -34,7 +34,7 @@ class Token;
|
|||
/** @brief Simple container to be thrown when internal error is detected. */
|
||||
struct InternalError {
|
||||
enum Type {AST, SYNTAX, UNKNOWN_MACRO, INTERNAL, LIMIT, INSTANTIATION};
|
||||
InternalError(const Token *tok, const std::string &errorMsg, Type type = INTERNAL);
|
||||
InternalError(const Token *tok, std::string errorMsg, Type type = INTERNAL);
|
||||
const Token *token;
|
||||
std::string errorMessage;
|
||||
Type type;
|
||||
|
|
|
@ -528,7 +528,7 @@ namespace {
|
|||
};
|
||||
|
||||
struct ItemDefinitionGroup {
|
||||
explicit ItemDefinitionGroup(const tinyxml2::XMLElement *idg, const std::string &includePaths) : additionalIncludePaths(includePaths) {
|
||||
explicit ItemDefinitionGroup(const tinyxml2::XMLElement *idg, std::string includePaths) : additionalIncludePaths(std::move(includePaths)) {
|
||||
const char *condAttr = idg->Attribute("Condition");
|
||||
if (condAttr)
|
||||
condition = condAttr;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
PathMatch::PathMatch(const std::vector<std::string> &excludedPaths, bool caseSensitive)
|
||||
: mExcludedPaths(excludedPaths), mCaseSensitive(caseSensitive)
|
||||
PathMatch::PathMatch(std::vector<std::string> excludedPaths, bool caseSensitive)
|
||||
: mExcludedPaths(std::move(excludedPaths)), mCaseSensitive(caseSensitive)
|
||||
{
|
||||
if (!mCaseSensitive)
|
||||
for (std::string& excludedPath : mExcludedPaths)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
* @param caseSensitive Match the case of the characters when
|
||||
* matching paths?
|
||||
*/
|
||||
explicit PathMatch(const std::vector<std::string> &excludedPaths, bool caseSensitive = true);
|
||||
explicit PathMatch(std::vector<std::string> excludedPaths, bool caseSensitive = true);
|
||||
|
||||
/**
|
||||
* @brief Match path against list of masks.
|
||||
|
|
|
@ -56,8 +56,8 @@ static std::string trim(const std::string& s)
|
|||
return s.substr(beg, end - beg + 1);
|
||||
}
|
||||
|
||||
Directive::Directive(const std::string &_file, const int _linenr, const std::string &_str) :
|
||||
file(_file),
|
||||
Directive::Directive(std::string _file, const int _linenr, const std::string &_str) :
|
||||
file(std::move(_file)),
|
||||
linenr(_linenr),
|
||||
str(trim(_str))
|
||||
{}
|
||||
|
@ -78,7 +78,7 @@ Preprocessor::~Preprocessor()
|
|||
|
||||
namespace {
|
||||
struct BadInlineSuppression {
|
||||
BadInlineSuppression(const simplecpp::Location &l, const std::string &msg) : location(l), errmsg(msg) {}
|
||||
BadInlineSuppression(const simplecpp::Location &l, std::string msg) : location(l), errmsg(std::move(msg)) {}
|
||||
simplecpp::Location location;
|
||||
std::string errmsg;
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
std::string str;
|
||||
|
||||
/** record a directive (possibly filtering src) */
|
||||
Directive(const std::string &_file, const int _linenr, const std::string &_str);
|
||||
Directive(std::string _file, const int _linenr, const std::string &_str);
|
||||
};
|
||||
|
||||
/// @addtogroup Core
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace {
|
|||
|
||||
class FindName {
|
||||
public:
|
||||
explicit FindName(const std::string &name) : mName(name) {}
|
||||
explicit FindName(std::string name) : mName(std::move(name)) {}
|
||||
bool operator()(const TemplateSimplifier::TokenAndName &tokenAndName) const {
|
||||
return tokenAndName.name() == mName;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace {
|
|||
|
||||
class FindFullName {
|
||||
public:
|
||||
explicit FindFullName(const std::string &fullName) : mFullName(fullName) {}
|
||||
explicit FindFullName(std::string fullName) : mFullName(std::move(fullName)) {}
|
||||
bool operator()(const TemplateSimplifier::TokenAndName &tokenAndName) const {
|
||||
return tokenAndName.fullName() == mFullName;
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ namespace {
|
|||
};
|
||||
}
|
||||
|
||||
TemplateSimplifier::TokenAndName::TokenAndName(Token *token, const std::string &scope) :
|
||||
mToken(token), mScope(scope), mName(mToken ? mToken->str() : ""),
|
||||
TemplateSimplifier::TokenAndName::TokenAndName(Token *token, std::string scope) :
|
||||
mToken(token), mScope(std::move(scope)), mName(mToken ? mToken->str() : ""),
|
||||
mFullName(mScope.empty() ? mName : (mScope + " :: " + mName)),
|
||||
mNameToken(nullptr), mParamEnd(nullptr), mFlags(0)
|
||||
{
|
||||
|
@ -109,8 +109,8 @@ TemplateSimplifier::TokenAndName::TokenAndName(Token *token, const std::string &
|
|||
}
|
||||
}
|
||||
|
||||
TemplateSimplifier::TokenAndName::TokenAndName(Token *token, const std::string &scope, const Token *nameToken, const Token *paramEnd) :
|
||||
mToken(token), mScope(scope), mName(nameToken->str()),
|
||||
TemplateSimplifier::TokenAndName::TokenAndName(Token *token, std::string scope, const Token *nameToken, const Token *paramEnd) :
|
||||
mToken(token), mScope(std::move(scope)), mName(nameToken->str()),
|
||||
mFullName(mScope.empty() ? mName : (mScope + " :: " + mName)),
|
||||
mNameToken(nameToken), mParamEnd(paramEnd), mFlags(0)
|
||||
{
|
||||
|
@ -1588,7 +1588,7 @@ void TemplateSimplifier::expandTemplate(
|
|||
const bool isSpecialization = templateDeclaration.isSpecialization();
|
||||
const bool isVariable = templateDeclaration.isVariable();
|
||||
struct newInstantiation {
|
||||
newInstantiation(Token *t, const std::string &s) : token(t), scope(s) {}
|
||||
newInstantiation(Token *t, std::string s) : token(t), scope(std::move(s)) {}
|
||||
Token *token;
|
||||
std::string scope;
|
||||
};
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
* \param token template instantiation name token "name<...>"
|
||||
* \param scope full qualification of template(scope)
|
||||
*/
|
||||
TokenAndName(Token *token, const std::string &scope);
|
||||
TokenAndName(Token *token, std::string scope);
|
||||
/**
|
||||
* Constructor used for declarations.
|
||||
* \param token template declaration token "template < ... >"
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
* \param nameToken template name token "template < ... > class name"
|
||||
* \param paramEnd template parameter end token ">"
|
||||
*/
|
||||
TokenAndName(Token *token, const std::string &scope, const Token *nameToken, const Token *paramEnd);
|
||||
TokenAndName(Token *token, std::string scope, const Token *nameToken, const Token *paramEnd);
|
||||
TokenAndName(const TokenAndName& other);
|
||||
~TokenAndName();
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ void TimerResults::addResults(const std::string& str, std::clock_t clocks)
|
|||
mResults[str].mNumberOfResults++;
|
||||
}
|
||||
|
||||
Timer::Timer(const std::string& str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults)
|
||||
: mStr(str)
|
||||
Timer::Timer(std::string str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults)
|
||||
: mStr(std::move(str))
|
||||
, mTimerResults(timerResults)
|
||||
, mStart(0)
|
||||
, mShowTimeMode(showtimeMode)
|
||||
|
|
|
@ -67,7 +67,7 @@ private:
|
|||
|
||||
class CPPCHECKLIB Timer {
|
||||
public:
|
||||
Timer(const std::string& str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults = nullptr);
|
||||
Timer(std::string str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults = nullptr);
|
||||
~Timer();
|
||||
|
||||
Timer(const Timer&) = delete;
|
||||
|
|
|
@ -1835,8 +1835,8 @@ namespace {
|
|||
struct ScopeInfo3 {
|
||||
enum Type { Global, Namespace, Record, MemberFunction, Other };
|
||||
ScopeInfo3() : parent(nullptr), type(Global), bodyStart(nullptr), bodyEnd(nullptr) {}
|
||||
ScopeInfo3(ScopeInfo3 *parent_, Type type_, const std::string &name_, const Token *bodyStart_, const Token *bodyEnd_)
|
||||
: parent(parent_), type(type_), name(name_), bodyStart(bodyStart_), bodyEnd(bodyEnd_) {
|
||||
ScopeInfo3(ScopeInfo3 *parent_, Type type_, std::string name_, const Token *bodyStart_, const Token *bodyEnd_)
|
||||
: parent(parent_), type(type_), name(std::move(name_)), bodyStart(bodyStart_), bodyEnd(bodyEnd_) {
|
||||
if (name.empty())
|
||||
return;
|
||||
fullName = name;
|
||||
|
@ -4182,7 +4182,7 @@ void Tokenizer::setVarIdPass1()
|
|||
|
||||
namespace {
|
||||
struct Member {
|
||||
Member(const std::list<std::string> &s, const std::list<const Token *> &ns, Token *t) : usingnamespaces(ns), scope(s), tok(t) {}
|
||||
Member(std::list<std::string> s, std::list<const Token *> ns, Token *t) : usingnamespaces(std::move(ns)), scope(std::move(s)), tok(t) {}
|
||||
std::list<const Token *> usingnamespaces;
|
||||
std::list<std::string> scope;
|
||||
Token *tok;
|
||||
|
|
|
@ -2880,7 +2880,7 @@ struct SingleValueFlowAnalyzer : ValueFlowAnalyzer {
|
|||
|
||||
SingleValueFlowAnalyzer() : ValueFlowAnalyzer() {}
|
||||
|
||||
SingleValueFlowAnalyzer(const ValueFlow::Value& v, const TokenList* t) : ValueFlowAnalyzer(t), value(v) {}
|
||||
SingleValueFlowAnalyzer(ValueFlow::Value v, const TokenList* t) : ValueFlowAnalyzer(t), value(std::move(v)) {}
|
||||
|
||||
const std::unordered_map<nonneg int, const Variable*>& getVars() const {
|
||||
return varids;
|
||||
|
@ -3798,11 +3798,11 @@ struct LifetimeStore {
|
|||
{}
|
||||
|
||||
LifetimeStore(const Token* argtok,
|
||||
const std::string& message,
|
||||
std::string message,
|
||||
ValueFlow::Value::LifetimeKind type = ValueFlow::Value::LifetimeKind::Object,
|
||||
bool inconclusive = false)
|
||||
: argtok(argtok),
|
||||
message(message),
|
||||
message(std::move(message)),
|
||||
type(type),
|
||||
errorPath(),
|
||||
inconclusive(inconclusive),
|
||||
|
|
Loading…
Reference in New Issue