Commit ae5e97a0 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Brad King

Delete some default constructors and assignment operators

They are unused, but if someone used them they would lead to
problems since they would copy the internal raw pointers
and the destructor would cause double delete
parent e3353a01
......@@ -22,6 +22,9 @@ public:
cmCPackGeneratorFactory();
~cmCPackGeneratorFactory();
cmCPackGeneratorFactory(const cmCPackGeneratorFactory&) = delete;
cmCPackGeneratorFactory& operator=(const cmCPackGeneratorFactory&) = delete;
//! Get the generator
cmCPackGenerator* NewGenerator(const std::string& name);
void DeleteGenerator(cmCPackGenerator* gen);
......
......@@ -26,6 +26,9 @@ public:
cmCPackLog();
~cmCPackLog();
cmCPackLog(const cmCPackLog&) = delete;
cmCPackLog& operator=(const cmCPackLog&) = delete;
enum __log_tags
{
NOTAG = 0,
......
......@@ -140,6 +140,11 @@ public:
cmSystemTools::SetStdoutCallback(nullptr);
cmSystemTools::SetMessageCallback(nullptr);
}
cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
delete;
cmCTestBuildAndTestCaptureRAII& operator=(
const cmCTestBuildAndTestCaptureRAII&) = delete;
};
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
......
......@@ -680,6 +680,8 @@ class cmCTestBuildHandler::LaunchHelper
public:
LaunchHelper(cmCTestBuildHandler* handler);
~LaunchHelper();
LaunchHelper(const LaunchHelper&) = delete;
LaunchHelper& operator=(const LaunchHelper&) = delete;
private:
cmCTestBuildHandler* Handler;
......
......@@ -52,6 +52,8 @@ public:
}
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 @@ struct cmCTestCoverageHandlerLocale
cmSystemTools::UnsetEnv("LC_ALL");
}
}
cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
cmCTestCoverageHandlerLocale& operator=(
const cmCTestCoverageHandlerLocale&) = delete;
std::string lc_all;
};
......
......@@ -16,6 +16,8 @@ class cmCTestCurl
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,
......
......@@ -76,6 +76,8 @@ public:
}
}
}
SaveRestoreErrorState(const SaveRestoreErrorState&) = delete;
SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete;
private:
bool InitialErrorState;
......
......@@ -28,6 +28,9 @@ private:
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();
......
......@@ -54,6 +54,8 @@ public:
{
}
~Entry() { archive_entry_free(this->Object); }
Entry(const Entry&) = delete;
Entry& operator=(const Entry&) = delete;
operator struct archive_entry*() { return this->Object; }
};
......
......@@ -58,6 +58,9 @@ public:
~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
......
......@@ -491,12 +491,16 @@ public:
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;
......
......@@ -182,6 +182,9 @@ public:
cmCTest();
~cmCTest();
cmCTest(const cmCTest&) = delete;
cmCTest& operator=(const cmCTest&) = delete;
/** Set the notes files to be created. */
void SetNotesFiles(const char* notes);
......
......@@ -31,6 +31,9 @@ public:
const std::string& config);
~cmComputeLinkDepends();
cmComputeLinkDepends(const cmComputeLinkDepends&) = delete;
cmComputeLinkDepends& operator=(const cmComputeLinkDepends&) = delete;
// Basic information about each link item.
struct LinkEntry
{
......
......@@ -32,6 +32,9 @@ public:
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;
......
......@@ -24,6 +24,10 @@ public:
cmDependsJavaParserHelper();
~cmDependsJavaParserHelper();
cmDependsJavaParserHelper(const cmDependsJavaParserHelper&) = delete;
cmDependsJavaParserHelper& operator=(const cmDependsJavaParserHelper&) =
delete;
int ParseString(const char* str, int verb);
int ParseFile(const char* file);
......
......@@ -28,6 +28,9 @@ public:
/** 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; }
......
......@@ -25,6 +25,9 @@ public:
/// Destructor
~cmExportSet();
cmExportSet(const cmExportSet&) = delete;
cmExportSet& operator=(const cmExportSet&) = delete;
void Compute(cmLocalGenerator* lg);
void AddTargetExport(cmTargetExport* tgt);
......
......@@ -23,6 +23,8 @@ void cmExportSetMap::clear()
this->derived::clear();
}
cmExportSetMap::cmExportSetMap() = default;
cmExportSetMap::~cmExportSetMap()
{
this->clear();
......
......@@ -25,8 +25,13 @@ public:
void clear();
cmExportSetMap();
/// Overloaded destructor deletes all member export sets.
~cmExportSetMap();
cmExportSetMap(const cmExportSetMap&) = delete;
cmExportSetMap& operator=(const cmExportSetMap&) = delete;
};
#endif
......@@ -2691,6 +2691,9 @@ public:
}
}
cURLEasyGuard(const cURLEasyGuard&) = delete;
cURLEasyGuard& operator=(const cURLEasyGuard&) = delete;
void release() { this->Easy = nullptr; }
private:
......
......@@ -20,6 +20,9 @@ public:
cmFileTimeComparison();
~cmFileTimeComparison();
cmFileTimeComparison(const cmFileTimeComparison&) = delete;
cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete;
/**
* Compare file modification times.
* Return true for successful comparison and false for error.
......
......@@ -1372,6 +1372,9 @@ public:
cmSystemTools::RemoveFile(this->File);
}
}
cmFindPackageCommandHoldFile(const cmFindPackageCommandHoldFile&) = delete;
cmFindPackageCommandHoldFile& operator=(
const cmFindPackageCommandHoldFile&) = delete;
void Release() { this->File = nullptr; }
};
......
......@@ -141,6 +141,9 @@ struct cmFortranParser_s
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);
......
......@@ -32,6 +32,9 @@ public:
Property();
~Property();
Property(const Property&) = delete;
Property& operator=(const Property&) = delete;
ExpressionVectorType ValueExpressions;
};
......@@ -41,6 +44,9 @@ public:
~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,
......
......@@ -27,6 +27,8 @@ struct cmListFileParser
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();
......
......@@ -348,6 +348,9 @@ public:
this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
}
cmMakefileCall(const cmMakefileCall&) = delete;
cmMakefileCall& operator=(const cmMakefileCall&) = delete;
private:
cmMakefile* Makefile;
};
......@@ -439,6 +442,9 @@ public:
~IncludeScope();
void Quiet() { this->ReportError = false; }
IncludeScope(const IncludeScope&) = delete;
IncludeScope& operator=(const IncludeScope&) = delete;
private:
cmMakefile* Makefile;
bool NoPolicyScope;
......@@ -606,6 +612,9 @@ public:
void Quiet() { this->ReportError = false; }
ListFileScope(const ListFileScope&) = delete;
ListFileScope& operator=(const ListFileScope&) = delete;
private:
cmMakefile* Makefile;
bool ReportError;
......@@ -1497,6 +1506,9 @@ public:
void Quiet() { this->ReportError = false; }
BuildsystemFileScope(const BuildsystemFileScope&) = delete;
BuildsystemFileScope& operator=(const BuildsystemFileScope&) = delete;
private:
cmMakefile* Makefile;
cmGlobalGenerator* GG;
......
......@@ -313,6 +313,9 @@ public:
PolicyPushPop(cmMakefile* m);
~PolicyPushPop();
PolicyPushPop(const PolicyPushPop&) = delete;
PolicyPushPop& operator=(const PolicyPushPop&) = delete;
private:
cmMakefile* Makefile;
};
......@@ -743,6 +746,9 @@ public:
cmPolicies::PolicyMap const& pm);
~FunctionPushPop();
FunctionPushPop(const FunctionPushPop&) = delete;
FunctionPushPop& operator=(const FunctionPushPop&) = delete;
void Quiet() { this->ReportError = false; }
private:
......@@ -757,6 +763,9 @@ public:
cmPolicies::PolicyMap const& pm);
~MacroPushPop();
MacroPushPop(const MacroPushPop&) = delete;
MacroPushPop& operator=(const MacroPushPop&) = delete;
void Quiet() { this->ReportError = false; }
private:
......
......@@ -25,6 +25,8 @@ public:
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);
......
......@@ -92,6 +92,9 @@ public:
*/
~cmLBDepend() { cmDeleteAll(this->DependInformationMap); }
cmLBDepend(const cmLBDepend&) = delete;
cmLBDepend& operator=(const cmLBDepend&) = delete;
/**
* Set the makefile that is used as a source of classes.
*/
......
......@@ -34,6 +34,9 @@ public:
~cmSourceFile();
cmSourceFile(const cmSourceFile&) = delete;
cmSourceFile& operator=(const cmSourceFile&) = delete;
/**
* Get the list of the custom commands for this source file
*/
......
......@@ -35,6 +35,9 @@ public:
cmState();
~cmState();
cmState(const cmState&) = delete;
cmState& operator=(const cmState&) = delete;
enum Mode
{
Unknown,
......
......@@ -521,6 +521,8 @@ public:
}
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 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
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);
}
......
......@@ -72,6 +72,9 @@ protected:
this->DeleteDataCall(this->ClientData);
}
}
Pair() = default;
Pair(const Pair&) = delete;
Pair& operator=(const Pair&) = delete;
};
typedef std::vector<std::shared_ptr<Pair>> VectorOfPairs;
......
......@@ -22,6 +22,9 @@ public:
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; }
......
......@@ -146,6 +146,8 @@ public:
xmlwr.StartDocument();
}
~cmXMLDocument() { xmlwr.EndDocument(); }
cmXMLDocument(const cmXMLDocument&) = delete;
cmXMLDocument& operator=(const cmXMLDocument&) = delete;
private:
friend class cmXMLElement;
......@@ -172,6 +174,9 @@ public:
}
~cmXMLElement() { xmlwr.EndElement(); }
cmXMLElement(const cmXMLElement&) = delete;
cmXMLElement& operator=(const cmXMLElement&) = delete;
template <typename T>
cmXMLElement& Attribute(const char* name, T const& value)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment