Merge topic 'delete_copy_assign'

ae5e97a005 Delete some default constructors and assignment operators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2968
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 7f633e4..972f0f7 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -22,6 +22,9 @@
   cmCPackGeneratorFactory();
   ~cmCPackGeneratorFactory();
 
+  cmCPackGeneratorFactory(const cmCPackGeneratorFactory&) = delete;
+  cmCPackGeneratorFactory& operator=(const cmCPackGeneratorFactory&) = delete;
+
   //! Get the generator
   cmCPackGenerator* NewGenerator(const std::string& name);
   void DeleteGenerator(cmCPackGenerator* gen);
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 8e99221..65281e3 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -26,6 +26,9 @@
   cmCPackLog();
   ~cmCPackLog();
 
+  cmCPackLog(const cmCPackLog&) = delete;
+  cmCPackLog& operator=(const cmCPackLog&) = delete;
+
   enum __log_tags
   {
     NOTAG = 0,
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 696b52f..b2c88df 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -140,6 +140,11 @@
     cmSystemTools::SetStdoutCallback(nullptr);
     cmSystemTools::SetMessageCallback(nullptr);
   }
+
+  cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
+    delete;
+  cmCTestBuildAndTestCaptureRAII& operator=(
+    const cmCTestBuildAndTestCaptureRAII&) = delete;
 };
 
 int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index af664ba..c75f4d4 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -680,6 +680,8 @@
 public:
   LaunchHelper(cmCTestBuildHandler* handler);
   ~LaunchHelper();
+  LaunchHelper(const LaunchHelper&) = delete;
+  LaunchHelper& operator=(const LaunchHelper&) = delete;
 
 private:
   cmCTestBuildHandler* Handler;
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 10928e0..4dda9ad 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -52,6 +52,8 @@
     }
     cmsysProcess_Delete(this->Process);
   }
+  cmCTestRunProcess(const cmCTestRunProcess&) = delete;
+  cmCTestRunProcess& operator=(const cmCTestRunProcess&) = delete;
   void SetCommand(const char* command)
   {
     this->CommandLineStrings.clear();
@@ -786,6 +788,9 @@
       cmSystemTools::UnsetEnv("LC_ALL");
     }
   }
+  cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
+  cmCTestCoverageHandlerLocale& operator=(
+    const cmCTestCoverageHandlerLocale&) = delete;
   std::string lc_all;
 };
 
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index 86d9489..6186af8 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -16,6 +16,8 @@
 public:
   cmCTestCurl(cmCTest*);
   ~cmCTestCurl();
+  cmCTestCurl(const cmCTestCurl&) = delete;
+  cmCTestCurl& operator=(const cmCTestCurl&) = delete;
   bool UploadFile(std::string const& local_file, std::string const& url,
                   std::string const& fields, std::string& response);
   bool HttpRequest(std::string const& url, std::string const& fields,
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 57a14ef..adf9553 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -76,6 +76,8 @@
       }
     }
   }
+  SaveRestoreErrorState(const SaveRestoreErrorState&) = delete;
+  SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete;
 
 private:
   bool InitialErrorState;
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index debbe59..107fd61 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -28,6 +28,9 @@
   cmCTestLaunch(int argc, const char* const* argv);
   ~cmCTestLaunch();
 
+  cmCTestLaunch(const cmCTestLaunch&) = delete;
+  cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
+
   // Run the real command.
   int Run();
   void RunChild();
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 6e5109a..23be603 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -54,6 +54,8 @@
   {
   }
   ~Entry() { archive_entry_free(this->Object); }
+  Entry(const Entry&) = delete;
+  Entry& operator=(const Entry&) = delete;
   operator struct archive_entry*() { return this->Object; }
 };
 
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 6ecdd63..1f23dae 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -58,6 +58,9 @@
 
   ~cmArchiveWrite();
 
+  cmArchiveWrite(const cmArchiveWrite&) = delete;
+  cmArchiveWrite& operator=(const cmArchiveWrite&) = delete;
+
   /**
    * Add a path (file or directory) to the archive.  Directories are
    * added recursively.  The "path" must be readable on disk, either
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 576d2c3..5efc784 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -491,12 +491,16 @@
   typedef std::map<cmSourceFile*, cmCPluginAPISourceFile*> derived;
   typedef derived::iterator iterator;
   typedef derived::value_type value_type;
+  cmCPluginAPISourceFileMap() = default;
   ~cmCPluginAPISourceFileMap()
   {
     for (auto const& i : *this) {
       delete i.second;
     }
   }
+  cmCPluginAPISourceFileMap(const cmCPluginAPISourceFileMap&) = delete;
+  cmCPluginAPISourceFileMap& operator=(const cmCPluginAPISourceFileMap&) =
+    delete;
 };
 cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
 
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 92a02c3..7dbf4d5 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -182,6 +182,9 @@
   cmCTest();
   ~cmCTest();
 
+  cmCTest(const cmCTest&) = delete;
+  cmCTest& operator=(const cmCTest&) = delete;
+
   /** Set the notes files to be created. */
   void SetNotesFiles(const char* notes);
 
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 252f874..dfaaf8b 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -31,6 +31,9 @@
                        const std::string& config);
   ~cmComputeLinkDepends();
 
+  cmComputeLinkDepends(const cmComputeLinkDepends&) = delete;
+  cmComputeLinkDepends& operator=(const cmComputeLinkDepends&) = delete;
+
   // Basic information about each link item.
   struct LinkEntry
   {
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 9684cff..7fd60c0 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -32,6 +32,9 @@
   cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config,
                            cmLocalGenerator* lg);
   ~cmCustomCommandGenerator();
+  cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
+  cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
+    delete;
   cmCustomCommand const& GetCC() const { return this->CC; }
   unsigned int GetNumberOfCommands() const;
   std::string GetCommand(unsigned int c) const;
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index 0b445d9..a673b5b 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -24,6 +24,10 @@
   cmDependsJavaParserHelper();
   ~cmDependsJavaParserHelper();
 
+  cmDependsJavaParserHelper(const cmDependsJavaParserHelper&) = delete;
+  cmDependsJavaParserHelper& operator=(const cmDependsJavaParserHelper&) =
+    delete;
+
   int ParseString(const char* str, int verb);
   int ParseFile(const char* file);
 
diff --git a/Source/cmELF.h b/Source/cmELF.h
index c8a91e4..987f0c3 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -28,6 +28,9 @@
   /** Destruct.   */
   ~cmELF();
 
+  cmELF(const cmELF&) = delete;
+  cmELF& operator=(const cmELF&) = delete;
+
   /** Get the error message if any.  */
   std::string const& GetErrorMessage() const { return this->ErrorMessage; }
 
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index 0ef306f..d654c12 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -25,6 +25,9 @@
   /// Destructor
   ~cmExportSet();
 
+  cmExportSet(const cmExportSet&) = delete;
+  cmExportSet& operator=(const cmExportSet&) = delete;
+
   void Compute(cmLocalGenerator* lg);
 
   void AddTargetExport(cmTargetExport* tgt);
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index 0740828..293e80c 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -23,6 +23,8 @@
   this->derived::clear();
 }
 
+cmExportSetMap::cmExportSetMap() = default;
+
 cmExportSetMap::~cmExportSetMap()
 {
   this->clear();
diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h
index 0f71c79..3853732 100644
--- a/Source/cmExportSetMap.h
+++ b/Source/cmExportSetMap.h
@@ -25,8 +25,13 @@
 
   void clear();
 
+  cmExportSetMap();
+
   /// Overloaded destructor deletes all member export sets.
   ~cmExportSetMap();
+
+  cmExportSetMap(const cmExportSetMap&) = delete;
+  cmExportSetMap& operator=(const cmExportSetMap&) = delete;
 };
 
 #endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index aec5a44..96c9e15 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2691,6 +2691,9 @@
     }
   }
 
+  cURLEasyGuard(const cURLEasyGuard&) = delete;
+  cURLEasyGuard& operator=(const cURLEasyGuard&) = delete;
+
   void release() { this->Easy = nullptr; }
 
 private:
diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h
index 5f74e34..b4e4eb3 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeComparison.h
@@ -20,6 +20,9 @@
   cmFileTimeComparison();
   ~cmFileTimeComparison();
 
+  cmFileTimeComparison(const cmFileTimeComparison&) = delete;
+  cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete;
+
   /**
    *  Compare file modification times.
    *  Return true for successful comparison and false for error.
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 45b096f..0d22ed8 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1372,6 +1372,9 @@
       cmSystemTools::RemoveFile(this->File);
     }
   }
+  cmFindPackageCommandHoldFile(const cmFindPackageCommandHoldFile&) = delete;
+  cmFindPackageCommandHoldFile& operator=(
+    const cmFindPackageCommandHoldFile&) = delete;
   void Release() { this->File = nullptr; }
 };
 
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index 0762340..6a33be5 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -141,6 +141,9 @@
                     std::set<std::string> defines, cmFortranSourceInfo& info);
   ~cmFortranParser_s();
 
+  cmFortranParser_s(const cmFortranParser_s&) = delete;
+  cmFortranParser_s& operator=(const cmFortranParser_s&) = delete;
+
   bool FindIncludeFile(const char* dir, const char* includeName,
                        std::string& fileName);
 
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 070b954..b7d602e 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -32,6 +32,9 @@
     Property();
     ~Property();
 
+    Property(const Property&) = delete;
+    Property& operator=(const Property&) = delete;
+
     ExpressionVectorType ValueExpressions;
   };
 
@@ -41,6 +44,9 @@
 
   ~cmInstalledFile();
 
+  cmInstalledFile(const cmInstalledFile&) = delete;
+  cmInstalledFile& operator=(const cmInstalledFile&) = delete;
+
   void RemoveProperty(const std::string& prop);
 
   void SetProperty(cmMakefile const* mf, const std::string& prop,
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index f855119..f99caed 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -27,6 +27,8 @@
   cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
                    cmMessenger* messenger, const char* filename);
   ~cmListFileParser();
+  cmListFileParser(const cmListFileParser&) = delete;
+  cmListFileParser& operator=(const cmListFileParser&) = delete;
   void IssueFileOpenError(std::string const& text) const;
   void IssueError(std::string const& text) const;
   bool ParseFile();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b0dacf1..560181f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -348,6 +348,9 @@
     this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
   }
 
+  cmMakefileCall(const cmMakefileCall&) = delete;
+  cmMakefileCall& operator=(const cmMakefileCall&) = delete;
+
 private:
   cmMakefile* Makefile;
 };
@@ -439,6 +442,9 @@
   ~IncludeScope();
   void Quiet() { this->ReportError = false; }
 
+  IncludeScope(const IncludeScope&) = delete;
+  IncludeScope& operator=(const IncludeScope&) = delete;
+
 private:
   cmMakefile* Makefile;
   bool NoPolicyScope;
@@ -606,6 +612,9 @@
 
   void Quiet() { this->ReportError = false; }
 
+  ListFileScope(const ListFileScope&) = delete;
+  ListFileScope& operator=(const ListFileScope&) = delete;
+
 private:
   cmMakefile* Makefile;
   bool ReportError;
@@ -1497,6 +1506,9 @@
 
   void Quiet() { this->ReportError = false; }
 
+  BuildsystemFileScope(const BuildsystemFileScope&) = delete;
+  BuildsystemFileScope& operator=(const BuildsystemFileScope&) = delete;
+
 private:
   cmMakefile* Makefile;
   cmGlobalGenerator* GG;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9f01986..0800ce4 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -313,6 +313,9 @@
     PolicyPushPop(cmMakefile* m);
     ~PolicyPushPop();
 
+    PolicyPushPop(const PolicyPushPop&) = delete;
+    PolicyPushPop& operator=(const PolicyPushPop&) = delete;
+
   private:
     cmMakefile* Makefile;
   };
@@ -743,6 +746,9 @@
                     cmPolicies::PolicyMap const& pm);
     ~FunctionPushPop();
 
+    FunctionPushPop(const FunctionPushPop&) = delete;
+    FunctionPushPop& operator=(const FunctionPushPop&) = delete;
+
     void Quiet() { this->ReportError = false; }
 
   private:
@@ -757,6 +763,9 @@
                  cmPolicies::PolicyMap const& pm);
     ~MacroPushPop();
 
+    MacroPushPop(const MacroPushPop&) = delete;
+    MacroPushPop& operator=(const MacroPushPop&) = delete;
+
     void Quiet() { this->ReportError = false; }
 
   private:
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 5916f7a..23e61d6 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -25,6 +25,8 @@
   cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
                      const char* purpose);
   ~cmOrderDirectories();
+  cmOrderDirectories(const cmOrderDirectories&) = delete;
+  cmOrderDirectories& operator=(const cmOrderDirectories&) = delete;
   void AddRuntimeLibrary(std::string const& fullPath,
                          const char* soname = nullptr);
   void AddLinkLibrary(std::string const& fullPath);
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 46d04a6..e0c1dad 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -92,6 +92,9 @@
    */
   ~cmLBDepend() { cmDeleteAll(this->DependInformationMap); }
 
+  cmLBDepend(const cmLBDepend&) = delete;
+  cmLBDepend& operator=(const cmLBDepend&) = delete;
+
   /**
    * Set the makefile that is used as a source of classes.
    */
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index a82a58a..d579018 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -34,6 +34,9 @@
 
   ~cmSourceFile();
 
+  cmSourceFile(const cmSourceFile&) = delete;
+  cmSourceFile& operator=(const cmSourceFile&) = delete;
+
   /**
    * Get the list of the custom commands for this source file
    */
diff --git a/Source/cmState.h b/Source/cmState.h
index f755f83..190eafc 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -35,6 +35,9 @@
   cmState();
   ~cmState();
 
+  cmState(const cmState&) = delete;
+  cmState& operator=(const cmState&) = delete;
+
   enum Mode
   {
     Unknown,
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f544fa1..f0e8077 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -521,6 +521,8 @@
     }
     free(this->ArgV);
   }
+  cmSystemToolsArgV(const cmSystemToolsArgV&) = delete;
+  cmSystemToolsArgV& operator=(const cmSystemToolsArgV&) = delete;
   void Store(std::vector<std::string>& args) const
   {
     for (char** arg = this->ArgV; arg && *arg; ++arg) {
@@ -533,7 +535,7 @@
                                          std::vector<std::string>& args)
 {
   // Invoke the underlying parser.
-  cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0);
+  cmSystemToolsArgV argv(cmsysSystem_Parse_CommandForUnix(command, 0));
   argv.Store(args);
 }
 
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 5855fed..1230101 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -72,6 +72,9 @@
         this->DeleteDataCall(this->ClientData);
       }
     }
+    Pair() = default;
+    Pair(const Pair&) = delete;
+    Pair& operator=(const Pair&) = delete;
   };
 
   typedef std::vector<std::shared_ptr<Pair>> VectorOfPairs;
diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h
index 1f18ce7..d4a164d 100644
--- a/Source/cmWorkingDirectory.h
+++ b/Source/cmWorkingDirectory.h
@@ -22,6 +22,9 @@
   cmWorkingDirectory(std::string const& newdir);
   ~cmWorkingDirectory();
 
+  cmWorkingDirectory(const cmWorkingDirectory&) = delete;
+  cmWorkingDirectory& operator=(const cmWorkingDirectory&) = delete;
+
   bool SetDirectory(std::string const& newdir);
   void Pop();
   bool Failed() const { return ResultCode != 0; }
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 1df8a09..512e103 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -146,6 +146,8 @@
     xmlwr.StartDocument();
   }
   ~cmXMLDocument() { xmlwr.EndDocument(); }
+  cmXMLDocument(const cmXMLDocument&) = delete;
+  cmXMLDocument& operator=(const cmXMLDocument&) = delete;
 
 private:
   friend class cmXMLElement;
@@ -172,6 +174,9 @@
   }
   ~cmXMLElement() { xmlwr.EndElement(); }
 
+  cmXMLElement(const cmXMLElement&) = delete;
+  cmXMLElement& operator=(const cmXMLElement&) = delete;
+
   template <typename T>
   cmXMLElement& Attribute(const char* name, T const& value)
   {