From 5a0784ddea62ee653a3a1199d4ff2140868d2c1d Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Mon, 21 Jan 2019 17:15:21 +0100 Subject: [PATCH] clang-tidy: Pass by value --- .clang-tidy | 1 - Source/CPack/cmCPackDebGenerator.cxx | 50 +++++++++---------- Source/CPack/cmCPackFreeBSDGenerator.cxx | 9 ++-- Source/CursesDialog/cmCursesMainForm.cxx | 5 +- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/QtDialog/QCMakeWidgets.cxx | 5 +- Source/QtDialog/QCMakeWidgets.h | 2 +- Source/cmAlgorithms.h | 4 +- Source/cmComputeLinkInformation.h | 6 +-- Source/cmConditionEvaluator.cxx | 9 ++-- Source/cmConditionEvaluator.h | 4 +- Source/cmCustomCommand.cxx | 18 ++++--- Source/cmCustomCommand.h | 11 ++-- Source/cmCustomCommandGenerator.cxx | 4 +- Source/cmCustomCommandGenerator.h | 4 +- Source/cmDepends.cxx | 4 +- Source/cmDepends.h | 2 +- Source/cmExpandedCommandArgument.cxx | 6 ++- Source/cmExpandedCommandArgument.h | 2 +- Source/cmExportSet.h | 5 +- Source/cmExternalMakefileProjectGenerator.cxx | 9 ++-- Source/cmExternalMakefileProjectGenerator.h | 3 +- Source/cmFileAPICodemodel.cxx | 6 +-- Source/cmFindPackageCommand.cxx | 12 ++--- Source/cmFortranParser.h | 10 ++-- Source/cmFortranParserImpl.cxx | 9 ++-- Source/cmGeneratorExpression.cxx | 11 ++-- Source/cmGeneratorExpression.h | 16 +++--- Source/cmGeneratorExpressionContext.cxx | 14 +++--- Source/cmGeneratorExpressionContext.h | 6 +-- Source/cmGeneratorExpressionDAGChecker.cxx | 12 ++--- Source/cmGeneratorExpressionDAGChecker.h | 6 +-- .../cmGeneratorExpressionEvaluationFile.cxx | 4 +- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionParser.cxx | 4 +- Source/cmGeneratorExpressionParser.h | 3 +- Source/cmGeneratorTarget.cxx | 5 +- Source/cmGlobVerificationManager.h | 8 +-- Source/cmGraphAdjacencyList.h | 5 +- Source/cmInstallCommandArguments.cxx | 4 +- Source/cmInstallCommandArguments.h | 2 +- Source/cmInstallTargetGenerator.cxx | 8 +-- Source/cmInstallTargetGenerator.h | 4 +- Source/cmLinkItem.cxx | 11 ++-- Source/cmLinkItem.h | 4 +- Source/cmListCommand.cxx | 11 ++-- Source/cmListFileCache.cxx | 7 ++- Source/cmListFileCache.h | 4 +- Source/cmLocalCommonGenerator.cxx | 5 +- Source/cmLocalCommonGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 6 +-- Source/cmLocalUnixMakefileGenerator3.h | 5 +- Source/cmOSXBundleGenerator.cxx | 5 +- Source/cmOSXBundleGenerator.h | 3 +- Source/cmPathLabel.cxx | 6 ++- Source/cmPathLabel.h | 2 +- Source/cmPipeConnection.cxx | 4 +- Source/cmPipeConnection.h | 2 +- Source/cmQtAutoGeneratorMocUic.h | 12 ++--- Source/cmRST.cxx | 4 +- Source/cmRST.h | 2 +- Source/cmRulePlaceholderExpander.cxx | 14 +++--- Source/cmRulePlaceholderExpander.h | 6 +-- Source/cmScriptGenerator.cxx | 11 ++-- Source/cmScriptGenerator.h | 4 +- Source/cmServerProtocol.cxx | 28 +++++------ Source/cmServerProtocol.h | 15 +++--- Source/cmSourceGroup.cxx | 6 ++- Source/cmSourceGroup.h | 2 +- Source/cmStringReplaceHelper.cxx | 5 +- Source/cmStringReplaceHelper.h | 8 +-- Source/cmUnexpectedCommand.h | 5 +- Source/cmXCodeScheme.cxx | 5 +- Source/cmXCodeScheme.h | 2 +- 74 files changed, 265 insertions(+), 257 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index aef99dcfe8..626c754daf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,7 +11,6 @@ misc-*,\ -misc-static-assert,\ modernize-*,\ -modernize-deprecated-headers,\ --modernize-pass-by-value,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 29968affcc..46a428faa1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -23,17 +23,15 @@ namespace { class DebGenerator { public: - DebGenerator(cmCPackLog* logger, std::string const& outputName, - std::string const& workDir, std::string const& topLevelDir, - std::string const& temporaryDir, + DebGenerator(cmCPackLog* logger, std::string outputName, std::string workDir, + std::string topLevelDir, std::string temporaryDir, const char* debianCompressionType, const char* debianArchiveType, - std::map const& controlValues, - bool genShLibs, std::string const& shLibsFilename, - bool genPostInst, std::string const& postInst, bool genPostRm, - std::string const& postRm, const char* controlExtra, - bool permissionStrctPolicy, - std::vector const& packageFiles); + std::map controlValues, + bool genShLibs, std::string shLibsFilename, bool genPostInst, + std::string postInst, bool genPostRm, std::string postRm, + const char* controlExtra, bool permissionStrctPolicy, + std::vector packageFiles); bool generate() const; @@ -66,31 +64,29 @@ private: }; DebGenerator::DebGenerator( - cmCPackLog* logger, std::string const& outputName, - std::string const& workDir, std::string const& topLevelDir, - std::string const& temporaryDir, const char* debianCompressionType, - const char* debianArchiveType, - std::map const& controlValues, bool genShLibs, - std::string const& shLibsFilename, bool genPostInst, - std::string const& postInst, bool genPostRm, std::string const& postRm, - const char* controlExtra, bool permissionStrictPolicy, - std::vector const& packageFiles) + cmCPackLog* logger, std::string outputName, std::string workDir, + std::string topLevelDir, std::string temporaryDir, + const char* debianCompressionType, const char* debianArchiveType, + std::map controlValues, bool genShLibs, + std::string shLibsFilename, bool genPostInst, std::string postInst, + bool genPostRm, std::string postRm, const char* controlExtra, + bool permissionStrictPolicy, std::vector packageFiles) : Logger(logger) - , OutputName(outputName) - , WorkDir(workDir) - , TopLevelDir(topLevelDir) - , TemporaryDir(temporaryDir) + , OutputName(std::move(outputName)) + , WorkDir(std::move(workDir)) + , TopLevelDir(std::move(topLevelDir)) + , TemporaryDir(std::move(temporaryDir)) , DebianArchiveType(debianArchiveType ? debianArchiveType : "gnutar") - , ControlValues(controlValues) + , ControlValues(std::move(controlValues)) , GenShLibs(genShLibs) - , ShLibsFilename(shLibsFilename) + , ShLibsFilename(std::move(shLibsFilename)) , GenPostInst(genPostInst) - , PostInst(postInst) + , PostInst(std::move(postInst)) , GenPostRm(genPostRm) - , PostRm(postRm) + , PostRm(std::move(postRm)) , ControlExtra(controlExtra) , PermissionStrictPolicy(permissionStrictPolicy) - , PackageFiles(packageFiles) + , PackageFiles(std::move(packageFiles)) { if (!debianCompressionType) { debianCompressionType = "gzip"; diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 1e6b1184c7..0ff005457d 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -17,6 +17,7 @@ #include #include +#include cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") @@ -97,8 +98,8 @@ class ManifestKey public: std::string key; - ManifestKey(const std::string& k) - : key(k) + ManifestKey(std::string k) + : key(std::move(k)) { } @@ -115,9 +116,9 @@ class ManifestKeyValue : public ManifestKey public: std::string value; - ManifestKeyValue(const std::string& k, const std::string& v) + ManifestKeyValue(const std::string& k, std::string v) : ManifestKey(k) - , value(v) + , value(std::move(v)) { } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 55ef3758ef..188ad69a3a 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -20,15 +20,16 @@ #include #include #include +#include inline int ctrl(int z) { return (z & 037); } -cmCursesMainForm::cmCursesMainForm(std::vector const& args, +cmCursesMainForm::cmCursesMainForm(std::vector args, int initWidth) - : Args(args) + : Args(std::move(args)) , InitialWidth(initWidth) { this->NumberOfPages = 0; diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 2c006cfb88..824025bcd1 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -26,7 +26,7 @@ class cmCursesMainForm : public cmCursesForm CM_DISABLE_COPY(cmCursesMainForm) public: - cmCursesMainForm(std::vector const& args, int initwidth); + cmCursesMainForm(std::vector args, int initwidth); ~cmCursesMainForm() override; /** diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index b544b8613b..eab418fe7c 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -7,10 +7,11 @@ #include #include #include +#include -QCMakeFileEditor::QCMakeFileEditor(QWidget* p, const QString& var) +QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var) : QLineEdit(p) - , Variable(var) + , Variable(std::move(var)) { this->ToolButton = new QToolButton(this); this->ToolButton->setText("..."); diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h index e63c197532..5d2368eab9 100644 --- a/Source/QtDialog/QCMakeWidgets.h +++ b/Source/QtDialog/QCMakeWidgets.h @@ -18,7 +18,7 @@ class QCMakeFileEditor : public QLineEdit { Q_OBJECT public: - QCMakeFileEditor(QWidget* p, const QString& var); + QCMakeFileEditor(QWidget* p, QString var); protected slots: virtual void chooseFile() = 0; signals: diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 2f8e675be2..9e3efd30ae 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -61,8 +61,8 @@ struct cmStrCmp : m_test(test) { } - cmStrCmp(const std::string& test) - : m_test(test) + cmStrCmp(std::string test) + : m_test(std::move(test)) { } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index db7eb96cfb..61fcf035e8 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -9,6 +9,7 @@ #include #include #include +#include #include class cmGeneratorTarget; @@ -31,9 +32,8 @@ public: struct Item { Item() {} - Item(std::string const& v, bool p, - cmGeneratorTarget const* target = nullptr) - : Value(v) + Item(std::string v, bool p, cmGeneratorTarget const* target = nullptr) + : Value(std::move(v)) , IsPath(p) , Target(target) { diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 33b9cf197a..94ea529ea5 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include "cmAlgorithms.h" #include "cmMakefile.h" @@ -53,11 +54,11 @@ static std::string const keyVERSION_LESS = "VERSION_LESS"; static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"; cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, - const cmListFileContext& context, - const cmListFileBacktrace& bt) + cmListFileContext context, + cmListFileBacktrace bt) : Makefile(makefile) - , ExecutionContext(context) - , Backtrace(bt) + , ExecutionContext(std::move(context)) + , Backtrace(std::move(bt)) , Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)) , Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)) , Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index fc87a2d256..59e1396f68 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -21,8 +21,8 @@ class cmConditionEvaluator public: typedef std::list cmArgumentList; - cmConditionEvaluator(cmMakefile& makefile, cmListFileContext const& context, - cmListFileBacktrace const& bt); + cmConditionEvaluator(cmMakefile& makefile, cmListFileContext context, + cmListFileBacktrace bt); // this is a shared function for both If and Else to determine if the // arguments were valid, and if so, was the response true. If there is diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 9dcec2f85c..242ceaab47 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -4,17 +4,19 @@ #include "cmMakefile.h" +#include + cmCustomCommand::cmCustomCommand(cmMakefile const* mf, - const std::vector& outputs, - const std::vector& byproducts, - const std::vector& depends, - const cmCustomCommandLines& commandLines, + std::vector outputs, + std::vector byproducts, + std::vector depends, + cmCustomCommandLines commandLines, const char* comment, const char* workingDirectory) - : Outputs(outputs) - , Byproducts(byproducts) - , Depends(depends) - , CommandLines(commandLines) + : Outputs(std::move(outputs)) + , Byproducts(std::move(byproducts)) + , Depends(std::move(depends)) + , CommandLines(std::move(commandLines)) , Comment(comment ? comment : "") , WorkingDirectory(workingDirectory ? workingDirectory : "") , HaveComment(comment != nullptr) diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index d82160bad9..50f15a46fd 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -23,12 +23,11 @@ class cmCustomCommand { public: /** Main constructor specifies all information for the command. */ - cmCustomCommand(cmMakefile const* mf, - const std::vector& outputs, - const std::vector& byproducts, - const std::vector& depends, - const cmCustomCommandLines& commandLines, - const char* comment, const char* workingDirectory); + cmCustomCommand(cmMakefile const* mf, std::vector outputs, + std::vector byproducts, + std::vector depends, + cmCustomCommandLines commandLines, const char* comment, + const char* workingDirectory); /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d1c173670b..6bf99468ee 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -16,10 +16,10 @@ #include cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, - const std::string& config, + std::string config, cmLocalGenerator* lg) : CC(cc) - , Config(config) + , Config(std::move(config)) , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index b7e2a39248..9684cffa87 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -29,8 +29,8 @@ class cmCustomCommandGenerator const char* GetArgv0Location(unsigned int c) const; public: - cmCustomCommandGenerator(cmCustomCommand const& cc, - const std::string& config, cmLocalGenerator* lg); + cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, + cmLocalGenerator* lg); ~cmCustomCommandGenerator(); cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 3b3783ac73..976ba5701f 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -13,9 +13,9 @@ #include #include -cmDepends::cmDepends(cmLocalGenerator* lg, const std::string& targetDir) +cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir) : LocalGenerator(lg) - , TargetDirectory(targetDir) + , TargetDirectory(std::move(targetDir)) , Dependee(new char[MaxPath]) , Depender(new char[MaxPath]) { diff --git a/Source/cmDepends.h b/Source/cmDepends.h index b0b5bb5011..c5e1d5bd9f 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -29,7 +29,7 @@ class cmDepends public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDepends(cmLocalGenerator* lg = nullptr, const std::string& targetDir = ""); + cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx index 650a5ad617..00848a6cc7 100644 --- a/Source/cmExpandedCommandArgument.cxx +++ b/Source/cmExpandedCommandArgument.cxx @@ -2,13 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExpandedCommandArgument.h" +#include + cmExpandedCommandArgument::cmExpandedCommandArgument() { } -cmExpandedCommandArgument::cmExpandedCommandArgument(std::string const& value, +cmExpandedCommandArgument::cmExpandedCommandArgument(std::string value, bool quoted) - : Value(value) + : Value(std::move(value)) , Quoted(quoted) { } diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h index d71fc92c10..69d35debed 100644 --- a/Source/cmExpandedCommandArgument.h +++ b/Source/cmExpandedCommandArgument.h @@ -18,7 +18,7 @@ class cmExpandedCommandArgument { public: cmExpandedCommandArgument(); - cmExpandedCommandArgument(std::string const& value, bool quoted); + cmExpandedCommandArgument(std::string value, bool quoted); std::string const& GetValue() const; diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index 58ad617d4e..0ef306f639 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include +#include #include class cmInstallExportGenerator; @@ -17,8 +18,8 @@ class cmExportSet { public: /// Construct an empty export set named \a name - cmExportSet(const std::string& name) - : Name(name) + cmExportSet(std::string name) + : Name(std::move(name)) { } /// Destructor diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index fecd8216ed..150995fb24 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExternalMakefileProjectGenerator.h" +#include + class cmMakefile; void cmExternalMakefileProjectGenerator::EnableLanguage( @@ -32,10 +34,9 @@ bool cmExternalMakefileProjectGenerator::Open( } cmExternalMakefileProjectGeneratorFactory:: - cmExternalMakefileProjectGeneratorFactory(const std::string& n, - const std::string& doc) - : Name(n) - , Documentation(doc) + cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc) + : Name(std::move(n)) + , Documentation(std::move(doc)) { } diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index d48abca789..492987dcd4 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -70,8 +70,7 @@ protected: class cmExternalMakefileProjectGeneratorFactory { public: - cmExternalMakefileProjectGeneratorFactory(const std::string& n, - const std::string& doc); + cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc); virtual ~cmExternalMakefileProjectGeneratorFactory(); std::string GetName() const; diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 078d1d51df..3363c9b35f 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -166,13 +166,13 @@ class BacktraceData } public: - BacktraceData(std::string const& topSource); + BacktraceData(std::string topSource); bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index); Json::Value Dump(); }; -BacktraceData::BacktraceData(std::string const& topSource) - : TopSource(topSource) +BacktraceData::BacktraceData(std::string topSource) + : TopSource(std::move(topSource)) { } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9ae1cb9730..2fc190cf78 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1760,8 +1760,8 @@ bool cmFileListGeneratorBase::Consider(std::string const& fullPath, class cmFileListGeneratorFixed : public cmFileListGeneratorBase { public: - cmFileListGeneratorFixed(std::string const& str) - : String(str) + cmFileListGeneratorFixed(std::string str) + : String(std::move(str)) { } cmFileListGeneratorFixed(cmFileListGeneratorFixed const& r) @@ -1940,8 +1940,8 @@ private: class cmFileListGeneratorCaseInsensitive : public cmFileListGeneratorBase { public: - cmFileListGeneratorCaseInsensitive(std::string const& str) - : String(str) + cmFileListGeneratorCaseInsensitive(std::string str) + : String(std::move(str)) { } cmFileListGeneratorCaseInsensitive( @@ -1982,8 +1982,8 @@ private: class cmFileListGeneratorGlob : public cmFileListGeneratorBase { public: - cmFileListGeneratorGlob(std::string const& str) - : Pattern(str) + cmFileListGeneratorGlob(std::string str) + : Pattern(std::move(str)) { } cmFileListGeneratorGlob(cmFileListGeneratorGlob const& r) diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 132b3e684a..8d4c90b7d9 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -8,6 +8,7 @@ # include # include +# include # include #endif @@ -114,10 +115,10 @@ int cmFortran_yyparse(yyscan_t); // Define parser object internal structure. struct cmFortranFile { - cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, const std::string& dir) + cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, std::string dir) : File(file) , Buffer(buffer) - , Directory(dir) + , Directory(std::move(dir)) , LastCharWasNewline(false) { } @@ -129,9 +130,8 @@ struct cmFortranFile struct cmFortranParser_s { - cmFortranParser_s(std::vector const& includes, - std::set const& defines, - cmFortranSourceInfo& info); + cmFortranParser_s(std::vector includes, + std::set defines, cmFortranSourceInfo& info); ~cmFortranParser_s(); bool FindIncludeFile(const char* dir, const char* includeName, diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 01cbb7843c..45481a4136 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include bool cmFortranParser_s::FindIncludeFile(const char* dir, @@ -42,11 +43,11 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir, return false; } -cmFortranParser_s::cmFortranParser_s(std::vector const& includes, - std::set const& defines, +cmFortranParser_s::cmFortranParser_s(std::vector includes, + std::set defines, cmFortranSourceInfo& info) - : IncludePath(includes) - , PPDefinitions(defines) + : IncludePath(std::move(includes)) + , PPDefinitions(std::move(defines)) , Info(info) { this->InInterface = false; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 96d4ad6a65..f3f9771167 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -15,9 +15,8 @@ #include "cmGeneratorExpressionParser.h" #include "cmSystemTools.h" -cmGeneratorExpression::cmGeneratorExpression( - const cmListFileBacktrace& backtrace) - : Backtrace(backtrace) +cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace) + : Backtrace(std::move(backtrace)) { } @@ -96,9 +95,9 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext( } cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( - cmListFileBacktrace const& backtrace, const std::string& input) - : Backtrace(backtrace) - , Input(input) + cmListFileBacktrace backtrace, std::string input) + : Backtrace(std::move(backtrace)) + , Input(std::move(input)) , HadContextSensitiveCondition(false) , HadHeadSensitiveCondition(false) , EvaluateForBuildsystem(false) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 9c05f60c82..e5463a7e81 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -11,6 +11,7 @@ #include // IWYU pragma: keep #include #include +#include #include class cmCompiledGeneratorExpression; @@ -35,8 +36,7 @@ class cmGeneratorExpression public: /** Construct. */ - cmGeneratorExpression( - cmListFileBacktrace const& backtrace = cmListFileBacktrace()); + cmGeneratorExpression(cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); std::unique_ptr Parse( @@ -140,8 +140,8 @@ private: cmGeneratorExpressionContext& context, cmGeneratorExpressionDAGChecker* dagChecker) const; - cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, - const std::string& input); + cmCompiledGeneratorExpression(cmListFileBacktrace backtrace, + std::string input); friend class cmGeneratorExpression; @@ -169,13 +169,13 @@ class cmGeneratorExpressionInterpreter public: cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, - std::string const& config, + std::string config, cmGeneratorTarget const* headTarget, - std::string const& lang = std::string()) + std::string lang = std::string()) : LocalGenerator(localGenerator) - , Config(config) + , Config(std::move(config)) , HeadTarget(headTarget) - , Language(lang) + , Language(std::move(lang)) { } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index a6dde5d39d..6d973310cf 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -2,15 +2,17 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGeneratorExpressionContext.h" +#include + cmGeneratorExpressionContext::cmGeneratorExpressionContext( - cmLocalGenerator* lg, std::string const& config, bool quiet, + cmLocalGenerator* lg, std::string config, bool quiet, cmGeneratorTarget const* headTarget, const cmGeneratorTarget* currentTarget, - bool evaluateForBuildsystem, cmListFileBacktrace const& backtrace, - std::string const& language) - : Backtrace(backtrace) + bool evaluateForBuildsystem, cmListFileBacktrace backtrace, + std::string language) + : Backtrace(std::move(backtrace)) , LG(lg) - , Config(config) - , Language(language) + , Config(std::move(config)) + , Language(std::move(language)) , HeadTarget(headTarget) , CurrentTarget(currentTarget) , Quiet(quiet) diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index 5b0123ec81..6e076bf542 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -14,12 +14,12 @@ class cmLocalGenerator; struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config, + cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string config, bool quiet, const cmGeneratorTarget* headTarget, cmGeneratorTarget const* currentTarget, bool evaluateForBuildsystem, - cmListFileBacktrace const& backtrace, - std::string const& language); + cmListFileBacktrace backtrace, + std::string language); cmListFileBacktrace Backtrace; std::set DependTargets; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 61b798bb5b..0f26e70cad 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -15,26 +15,26 @@ #include cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( - const cmListFileBacktrace& backtrace, cmGeneratorTarget const* target, - const std::string& property, const GeneratorExpressionContent* content, + cmListFileBacktrace backtrace, cmGeneratorTarget const* target, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent) : Parent(parent) , Target(target) - , Property(property) + , Property(std::move(property)) , Content(content) - , Backtrace(backtrace) + , Backtrace(std::move(backtrace)) , TransitivePropertiesOnly(false) { Initialize(); } cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( - cmGeneratorTarget const* target, const std::string& property, + cmGeneratorTarget const* target, std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent) : Parent(parent) , Target(target) - , Property(property) + , Property(std::move(property)) , Content(content) , Backtrace() , TransitivePropertiesOnly(false) diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 1525c39de2..e1fba5e5cf 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -42,13 +42,13 @@ class cmGeneratorTarget; struct cmGeneratorExpressionDAGChecker { - cmGeneratorExpressionDAGChecker(const cmListFileBacktrace& backtrace, + cmGeneratorExpressionDAGChecker(cmListFileBacktrace backtrace, cmGeneratorTarget const* target, - const std::string& property, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent); cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target, - const std::string& property, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent); diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 1c33a6ef0b..326cb0e555 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -18,11 +18,11 @@ #include "cmSystemTools.h" cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( - const std::string& input, + std::string input, std::unique_ptr outputFileExpr, std::unique_ptr condition, bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070) - : Input(input) + : Input(std::move(input)) , OutputFileExpr(std::move(outputFileExpr)) , Condition(std::move(condition)) , InputIsContent(inputIsContent) diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 2a790697f5..89a2390571 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -20,7 +20,7 @@ class cmGeneratorExpressionEvaluationFile { public: cmGeneratorExpressionEvaluationFile( - const std::string& input, + std::string input, std::unique_ptr outputFileExpr, std::unique_ptr condition, bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070); diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 489970ce34..949a86d81f 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -9,8 +9,8 @@ #include cmGeneratorExpressionParser::cmGeneratorExpressionParser( - const std::vector& tokens) - : Tokens(tokens) + std::vector tokens) + : Tokens(std::move(tokens)) , NestingLevel(0) { } diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h index 633381c8a9..e663496dae 100644 --- a/Source/cmGeneratorExpressionParser.h +++ b/Source/cmGeneratorExpressionParser.h @@ -13,8 +13,7 @@ struct cmGeneratorExpressionEvaluator; struct cmGeneratorExpressionParser { - cmGeneratorExpressionParser( - const std::vector& tokens); + cmGeneratorExpressionParser(std::vector tokens); void Parse(std::vector& result); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eb3d4af594..0e3ace3cc5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" @@ -1805,10 +1806,10 @@ class cmTargetCollectLinkLanguages { public: cmTargetCollectLinkLanguages(cmGeneratorTarget const* target, - const std::string& config, + std::string config, std::unordered_set& languages, cmGeneratorTarget const* head) - : Config(config) + : Config(std::move(config)) , Languages(languages) , HeadTarget(head) , Target(target) diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index cdbd27510a..c293a764dd 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -55,13 +55,13 @@ private: const bool FollowSymlinks; const std::string Relative; const std::string Expression; - CacheEntryKey(const bool rec, const bool l, const bool s, - const std::string& rel, const std::string& e) + CacheEntryKey(const bool rec, const bool l, const bool s, std::string rel, + std::string e) : Recurse(rec) , ListDirectories(l) , FollowSymlinks(s) - , Relative(rel) - , Expression(e) + , Relative(std::move(rel)) + , Expression(std::move(e)) { } bool operator<(const CacheEntryKey& r) const; diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h index fb2eee23b1..5ca9269ed7 100644 --- a/Source/cmGraphAdjacencyList.h +++ b/Source/cmGraphAdjacencyList.h @@ -7,6 +7,7 @@ #include "cmListFileCache.h" +#include #include /** @@ -17,10 +18,10 @@ class cmGraphEdge { public: - cmGraphEdge(int n, bool s, cmListFileBacktrace const& bt) + cmGraphEdge(int n, bool s, cmListFileBacktrace bt) : Dest(n) , Strong(s) - , Backtrace(bt) + , Backtrace(std::move(bt)) { } operator int() const { return this->Dest; } diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 538aa9f75c..4f872f4dbf 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -16,7 +16,7 @@ const char* cmInstallCommandArguments::PermissionsTable[] = { const std::string cmInstallCommandArguments::EmptyString; cmInstallCommandArguments::cmInstallCommandArguments( - const std::string& defaultComponent) + std::string defaultComponent) : Destination(&Parser, "DESTINATION", &ArgumentGroup) , Component(&Parser, "COMPONENT", &ArgumentGroup) , NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup) @@ -29,7 +29,7 @@ cmInstallCommandArguments::cmInstallCommandArguments( , NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup) , Type(&Parser, "TYPE", &ArgumentGroup) , GenericArguments(nullptr) - , DefaultComponentName(defaultComponent) + , DefaultComponentName(std::move(defaultComponent)) { } diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 425e58a2cb..8e974af6e7 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -13,7 +13,7 @@ class cmInstallCommandArguments { public: - cmInstallCommandArguments(const std::string& defaultComponent); + cmInstallCommandArguments(std::string defaultComponent); void SetGenericArguments(cmInstallCommandArguments* args) { this->GenericArguments = args; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 86c6a582b3..08f46aac8e 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -22,18 +22,18 @@ #include "cmake.h" cmInstallTargetGenerator::cmInstallTargetGenerator( - const std::string& targetName, const char* dest, bool implib, + std::string targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - bool optional, cmListFileBacktrace const& backtrace) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, exclude_from_all) - , TargetName(targetName) + , TargetName(std::move(targetName)) , Target(nullptr) , FilePermissions(file_permissions) , ImportLibrary(implib) , Optional(optional) - , Backtrace(backtrace) + , Backtrace(std::move(backtrace)) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index bf625d18cf..715b4ae69f 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -23,11 +23,11 @@ class cmInstallTargetGenerator : public cmInstallGenerator { public: cmInstallTargetGenerator( - std::string const& targetName, const char* dest, bool implib, + std::string targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, bool optional, - cmListFileBacktrace const& backtrace = cmListFileBacktrace()); + cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmInstallTargetGenerator() override; /** Select the policy for installing shared library linkable name diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx index 12a07f6765..b035c8c713 100644 --- a/Source/cmLinkItem.cxx +++ b/Source/cmLinkItem.cxx @@ -10,16 +10,15 @@ cmLinkItem::cmLinkItem() { } -cmLinkItem::cmLinkItem(std::string const& n, cmListFileBacktrace const& bt) - : String(n) - , Backtrace(bt) +cmLinkItem::cmLinkItem(std::string n, cmListFileBacktrace bt) + : String(std::move(n)) + , Backtrace(std::move(bt)) { } -cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, - cmListFileBacktrace const& bt) +cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt) : Target(t) - , Backtrace(bt) + , Backtrace(std::move(bt)) { } diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index b841509e84..d2459db6cb 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -24,8 +24,8 @@ class cmLinkItem public: cmLinkItem(); - cmLinkItem(std::string const& s, cmListFileBacktrace const& bt); - cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace const& bt); + cmLinkItem(std::string s, cmListFileBacktrace bt); + cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt); std::string const& AsStr() const; cmGeneratorTarget const* Target = nullptr; cmListFileBacktrace Backtrace; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index b826795d07..05b22cfae7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -659,15 +659,14 @@ bool cmListCommand::HandleTransformCommand( // Transform: lambda function implementing the action struct ActionDescriptor { - ActionDescriptor(const std::string& name) - : Name(name) + ActionDescriptor(std::string name) + : Name(std::move(name)) { } - ActionDescriptor(const std::string& name, int arity, - const transform_type& transform) - : Name(name) + ActionDescriptor(std::string name, int arity, transform_type transform) + : Name(std::move(name)) , Arity(arity) - , Transform(transform) + , Transform(std::move(transform)) { } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 9aa1f32e3b..ff793f6820 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -24,7 +24,7 @@ cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=( struct cmListFileParser { - cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt, + cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, cmMessenger* messenger, const char* filename); ~cmListFileParser(); void IssueFileOpenError(std::string const& text) const; @@ -47,12 +47,11 @@ struct cmListFileParser } Separation; }; -cmListFileParser::cmListFileParser(cmListFile* lf, - cmListFileBacktrace const& lfbt, +cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, cmMessenger* messenger, const char* filename) : ListFile(lf) - , Backtrace(lfbt) + , Backtrace(std::move(lfbt)) , Messenger(messenger) , FileName(filename) , Lexer(cmListFileLexer_New()) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 4a247bad1f..529c3891d4 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -51,8 +51,8 @@ struct cmListFileArgument Bracket }; cmListFileArgument() {} - cmListFileArgument(const std::string& v, Delimiter d, long line) - : Value(v) + cmListFileArgument(std::string v, Delimiter d, long line) + : Value(std::move(v)) , Delim(d) , Line(line) { diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 7ce2c828fa..c6d2c5873c 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -12,10 +12,9 @@ class cmGlobalGenerator; cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmMakefile* mf, - std::string const& wd) + cmMakefile* mf, std::string wd) : cmLocalGenerator(gg, mf) - , WorkingDirectory(wd) + , WorkingDirectory(std::move(wd)) { // Store the configuration name that will be generated. if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 7b8e6fe8ad..abebbc2a75 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -22,7 +22,7 @@ class cmLocalCommonGenerator : public cmLocalGenerator { public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, - std::string const& wd); + std::string wd); ~cmLocalCommonGenerator() override; std::string const& GetConfigName() { return this->ConfigName; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5b9d108d36..c50dcb766b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1733,9 +1733,9 @@ class NotInProjectDir { public: // Constructor with the source and binary directory's path - NotInProjectDir(const std::string& sourceDir, const std::string& binaryDir) - : SourceDir(sourceDir) - , BinaryDir(binaryDir) + NotInProjectDir(std::string sourceDir, std::string binaryDir) + : SourceDir(std::move(sourceDir)) + , BinaryDir(std::move(binaryDir)) { } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index c0d0e13d12..5268e6b0cc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -12,6 +12,7 @@ #include #include #include +#include #include class cmCustomCommand; @@ -267,9 +268,9 @@ private: cmGeneratorTarget* Target = nullptr; std::string Language; LocalObjectEntry() {} - LocalObjectEntry(cmGeneratorTarget* t, const std::string& lang) + LocalObjectEntry(cmGeneratorTarget* t, std::string lang) : Target(t) - , Language(lang) + , Language(std::move(lang)) { } }; diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 2b9678596a..6857d5a27e 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -10,15 +10,16 @@ #include "cmTarget.h" #include +#include class cmSourceFile; cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target, - const std::string& configName) + std::string configName) : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(target->GetLocalGenerator()) - , ConfigName(configName) + , ConfigName(std::move(configName)) , MacContentFolders(nullptr) { if (this->MustSkip()) { diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index be7e932f93..ba5bee03a9 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -17,8 +17,7 @@ class cmSourceFile; class cmOSXBundleGenerator { public: - cmOSXBundleGenerator(cmGeneratorTarget* target, - const std::string& configName); + cmOSXBundleGenerator(cmGeneratorTarget* target, std::string configName); // create an app bundle at a given root, and return // the directory within the bundle that contains the executable diff --git a/Source/cmPathLabel.cxx b/Source/cmPathLabel.cxx index 4793206f95..fb8135101b 100644 --- a/Source/cmPathLabel.cxx +++ b/Source/cmPathLabel.cxx @@ -2,8 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPathLabel.h" -cmPathLabel::cmPathLabel(const std::string& label) - : Label(label) +#include + +cmPathLabel::cmPathLabel(std::string label) + : Label(std::move(label)) , Hash(0) { // Use a Jenkins one-at-a-time hash with under/over-flow protection diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h index 97551fb463..55dffabe03 100644 --- a/Source/cmPathLabel.h +++ b/Source/cmPathLabel.h @@ -17,7 +17,7 @@ class cmPathLabel { public: - cmPathLabel(const std::string& label); + cmPathLabel(std::string label); // The comparison operators are only for quick sorting and searching and // in no way imply any lexicographical order of the label diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx index 999d6f3c70..1eede13e01 100644 --- a/Source/cmPipeConnection.cxx +++ b/Source/cmPipeConnection.cxx @@ -6,10 +6,10 @@ #include "cmServer.h" -cmPipeConnection::cmPipeConnection(const std::string& name, +cmPipeConnection::cmPipeConnection(std::string name, cmConnectionBufferStrategy* bufferStrategy) : cmEventBasedConnection(bufferStrategy) - , PipeName(name) + , PipeName(std::move(name)) { } diff --git a/Source/cmPipeConnection.h b/Source/cmPipeConnection.h index 49f9fdf8ad..e67f15c57e 100644 --- a/Source/cmPipeConnection.h +++ b/Source/cmPipeConnection.h @@ -13,7 +13,7 @@ class cmPipeConnection : public cmEventBasedConnection { public: - cmPipeConnection(const std::string& name, + cmPipeConnection(std::string name, cmConnectionBufferStrategy* bufferStrategy = nullptr); bool OnServeStart(std::string* pString) override; diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index 9ec1def350..0df2cffebd 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -49,8 +49,8 @@ public: { } - KeyExpT(std::string const& key, std::string const& exp) - : Key(key) + KeyExpT(std::string key, std::string const& exp) + : Key(std::move(key)) , Exp(exp) { } @@ -240,10 +240,10 @@ public: class JobMocT : public JobT { public: - JobMocT(std::string&& sourceFile, std::string const& includerFile, + JobMocT(std::string&& sourceFile, std::string includerFile, std::string&& includeString) : SourceFile(std::move(sourceFile)) - , IncluderFile(includerFile) + , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) { } @@ -269,10 +269,10 @@ public: class JobUicT : public JobT { public: - JobUicT(std::string&& sourceFile, std::string const& includerFile, + JobUicT(std::string&& sourceFile, std::string includerFile, std::string&& includeString) : SourceFile(std::move(sourceFile)) - , IncluderFile(includerFile) + , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) { } diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 2866a39d94..55204d708e 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -13,9 +13,9 @@ #include #include -cmRST::cmRST(std::ostream& os, std::string const& docroot) +cmRST::cmRST(std::ostream& os, std::string docroot) : OS(os) - , DocRoot(docroot) + , DocRoot(std::move(docroot)) , IncludeDepth(0) , OutputLinePending(false) , LastLineEndedInColonColon(false) diff --git a/Source/cmRST.h b/Source/cmRST.h index ee478677d6..d8d2a0bab5 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -25,7 +25,7 @@ class cmRST { public: - cmRST(std::ostream& os, std::string const& docroot); + cmRST(std::ostream& os, std::string docroot); bool ProcessFile(std::string const& fname, bool isModule = false); private: diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index c3e8ff57f5..e347a2cf5e 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -10,13 +10,13 @@ #include "cmSystemTools.h" cmRulePlaceholderExpander::cmRulePlaceholderExpander( - std::map const& compilers, - std::map const& variableMappings, - std::string const& compilerSysroot, std::string const& linkerSysroot) - : Compilers(compilers) - , VariableMappings(variableMappings) - , CompilerSysroot(compilerSysroot) - , LinkerSysroot(linkerSysroot) + std::map compilers, + std::map variableMappings, + std::string compilerSysroot, std::string linkerSysroot) + : Compilers(std::move(compilers)) + , VariableMappings(std::move(variableMappings)) + , CompilerSysroot(std::move(compilerSysroot)) + , LinkerSysroot(std::move(linkerSysroot)) { } diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 7aa63db90a..5c0363729a 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -15,9 +15,9 @@ class cmRulePlaceholderExpander { public: cmRulePlaceholderExpander( - std::map const& compilers, - std::map const& variableMappings, - std::string const& compilerSysroot, std::string const& linkerSysroot); + std::map compilers, + std::map variableMappings, + std::string compilerSysroot, std::string linkerSysroot); void SetTargetImpLib(std::string const& targetImpLib) { diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 2cae714369..ae0a158845 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -4,11 +4,12 @@ #include "cmSystemTools.h" -cmScriptGenerator::cmScriptGenerator( - const std::string& config_var, - std::vector const& configurations) - : RuntimeConfigVariable(config_var) - , Configurations(configurations) +#include + +cmScriptGenerator::cmScriptGenerator(std::string config_var, + std::vector configurations) + : RuntimeConfigVariable(std::move(config_var)) + , Configurations(std::move(configurations)) , ConfigurationName("") , ConfigurationTypes(nullptr) , ActionsPerConfig(false) diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 0bb388e635..725cbc6d65 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -47,8 +47,8 @@ class cmScriptGenerator CM_DISABLE_COPY(cmScriptGenerator) public: - cmScriptGenerator(const std::string& config_var, - std::vector const& configurations); + cmScriptGenerator(std::string config_var, + std::vector configurations); virtual ~cmScriptGenerator(); void Generate(std::ostream& os, const std::string& config, diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 11a3f46e03..c3c81564ee 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include // Get rid of some windows macros: @@ -39,11 +40,10 @@ std::vector toStringList(const Json::Value& in) } // namespace cmServerRequest::cmServerRequest(cmServer* server, cmConnection* connection, - const std::string& t, const std::string& c, - const Json::Value& d) - : Type(t) - , Cookie(c) - , Data(d) + std::string t, std::string c, Json::Value d) + : Type(std::move(t)) + , Cookie(std::move(c)) + , Data(std::move(d)) , Connection(connection) , m_Server(server) { @@ -707,15 +707,15 @@ cmServerResponse cmServerProtocol1::ProcessCTests( } cmServerProtocol1::GeneratorInformation::GeneratorInformation( - const std::string& generatorName, const std::string& extraGeneratorName, - const std::string& toolset, const std::string& platform, - const std::string& sourceDirectory, const std::string& buildDirectory) - : GeneratorName(generatorName) - , ExtraGeneratorName(extraGeneratorName) - , Toolset(toolset) - , Platform(platform) - , SourceDirectory(sourceDirectory) - , BuildDirectory(buildDirectory) + std::string generatorName, std::string extraGeneratorName, + std::string toolset, std::string platform, std::string sourceDirectory, + std::string buildDirectory) + : GeneratorName(std::move(generatorName)) + , ExtraGeneratorName(std::move(extraGeneratorName)) + , Toolset(std::move(toolset)) + , Platform(std::move(platform)) + , SourceDirectory(std::move(sourceDirectory)) + , BuildDirectory(std::move(buildDirectory)) { } diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h index df71cffc70..2d1507b43c 100644 --- a/Source/cmServerProtocol.h +++ b/Source/cmServerProtocol.h @@ -56,9 +56,8 @@ public: cmConnection* Connection; private: - cmServerRequest(cmServer* server, cmConnection* connection, - const std::string& t, const std::string& c, - const Json::Value& d); + cmServerRequest(cmServer* server, cmConnection* connection, std::string t, + std::string c, Json::Value d); void ReportProgress(int min, int current, int max, const std::string& message) const; @@ -140,12 +139,10 @@ private: { public: GeneratorInformation() = default; - GeneratorInformation(const std::string& generatorName, - const std::string& extraGeneratorName, - const std::string& toolset, - const std::string& platform, - const std::string& sourceDirectory, - const std::string& buildDirectory); + GeneratorInformation(std::string generatorName, + std::string extraGeneratorName, std::string toolset, + std::string platform, std::string sourceDirectory, + std::string buildDirectory); void SetupGenerator(cmake* cm, std::string* errorMessage); diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 12ef62bc28..7e1e836a0b 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -2,15 +2,17 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceGroup.h" +#include + class cmSourceGroupInternals { public: std::vector GroupChildren; }; -cmSourceGroup::cmSourceGroup(const std::string& name, const char* regex, +cmSourceGroup::cmSourceGroup(std::string name, const char* regex, const char* parentName) - : Name(name) + : Name(std::move(name)) { this->Internal = new cmSourceGroupInternals; this->SetGroupRegex(regex); diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index b39f8ddb13..7c65494463 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -26,7 +26,7 @@ class cmSourceGroupInternals; class cmSourceGroup { public: - cmSourceGroup(const std::string& name, const char* regex, + cmSourceGroup(std::string name, const char* regex, const char* parentName = nullptr); cmSourceGroup(cmSourceGroup const& r); ~cmSourceGroup(); diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx index f50cf58bbd..4a6298782d 100644 --- a/Source/cmStringReplaceHelper.cxx +++ b/Source/cmStringReplaceHelper.cxx @@ -5,13 +5,14 @@ #include "cmMakefile.h" #include +#include cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex, - const std::string& replace_expr, + std::string replace_expr, cmMakefile* makefile) : RegExString(regex) , RegularExpression(regex) - , ReplaceExpression(replace_expr) + , ReplaceExpression(std::move(replace_expr)) , Makefile(makefile) { this->ParseReplaceExpression(); diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h index 3e76d86d5d..5cebde7644 100644 --- a/Source/cmStringReplaceHelper.h +++ b/Source/cmStringReplaceHelper.h @@ -6,6 +6,7 @@ #include "cmsys/RegularExpression.hxx" #include +#include #include class cmMakefile; @@ -13,8 +14,7 @@ class cmMakefile; class cmStringReplaceHelper { public: - cmStringReplaceHelper(const std::string& regex, - const std::string& replace_expr, + cmStringReplaceHelper(const std::string& regex, std::string replace_expr, cmMakefile* makefile = nullptr); bool IsRegularExpressionValid() const @@ -39,9 +39,9 @@ private: , Value(s) { } - RegexReplacement(const std::string& s) + RegexReplacement(std::string s) : Number(-1) - , Value(s) + , Value(std::move(s)) { } RegexReplacement(int n) diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h index 7154881a4d..33d6bdc2c2 100644 --- a/Source/cmUnexpectedCommand.h +++ b/Source/cmUnexpectedCommand.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include +#include #include #include "cmCommand.h" @@ -15,8 +16,8 @@ class cmExecutionStatus; class cmUnexpectedCommand : public cmCommand { public: - cmUnexpectedCommand(std::string const& name, const char* error) - : Name(name) + cmUnexpectedCommand(std::string name, const char* error) + : Name(std::move(name)) , Error(error) { } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index d301ad0d60..1b161987af 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -5,16 +5,17 @@ #include #include #include +#include #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmXMLSafe.h" -cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests, +cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests, const std::vector& configList, unsigned int xcVersion) : Target(xcObj) - , Tests(tests) + , Tests(std::move(tests)) , TargetName(xcObj->GetTarget()->GetName()) , ConfigList(configList) , XcodeVersion(xcVersion) diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index 96c76e6424..8c47123599 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -20,7 +20,7 @@ class cmXCodeScheme public: typedef std::vector TestObjects; - cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests, + cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests, const std::vector& configList, unsigned int xcVersion);