Merge topic 'clear-generator-data'

5cf1120 cmGlobalGenerator: Refactor member cleanup between configures
This commit is contained in:
Brad King 2013-11-06 08:39:01 -05:00 committed by CMake Topic Stage
commit ef3dc6507e
2 changed files with 38 additions and 48 deletions

View File

@ -66,32 +66,12 @@ cmGlobalGenerator::cmGlobalGenerator()
cmGlobalGenerator::~cmGlobalGenerator() cmGlobalGenerator::~cmGlobalGenerator()
{ {
// Delete any existing cmLocalGenerators this->ClearGeneratorMembers();
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
delete this->LocalGenerators[i];
}
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
li = this->EvaluationFiles.begin();
li != this->EvaluationFiles.end();
++li)
{
delete *li;
}
for(std::map<std::string, cmExportBuildFileGenerator*>::iterator
i = this->BuildExportSets.begin();
i != this->BuildExportSets.end(); ++i)
{
delete i->second;
}
this->LocalGenerators.clear();
if (this->ExtraGenerator) if (this->ExtraGenerator)
{ {
delete this->ExtraGenerator; delete this->ExtraGenerator;
} }
this->ClearGeneratorTargets();
} }
bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts)
@ -970,31 +950,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
void cmGlobalGenerator::Configure() void cmGlobalGenerator::Configure()
{ {
this->FirstTimeProgress = 0.0f; this->FirstTimeProgress = 0.0f;
this->ClearGeneratorTargets(); this->ClearGeneratorMembers();
this->ExportSets.clear();
// Delete any existing cmLocalGenerators
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
delete this->LocalGenerators[i];
}
this->LocalGenerators.clear();
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
li = this->EvaluationFiles.begin();
li != this->EvaluationFiles.end();
++li)
{
delete *li;
}
this->EvaluationFiles.clear();
this->TargetDependencies.clear();
this->TotalTargets.clear();
this->ImportedTargets.clear();
this->LocalGeneratorToTargetMap.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
this->BinaryDirectories.clear();
// start with this directory // start with this directory
cmLocalGenerator *lg = this->CreateLocalGenerator(); cmLocalGenerator *lg = this->CreateLocalGenerator();
@ -1399,7 +1355,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorTargets() void cmGlobalGenerator::ClearGeneratorMembers()
{ {
for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
i != this->GeneratorTargets.end(); ++i) i != this->GeneratorTargets.end(); ++i)
@ -1407,6 +1363,39 @@ void cmGlobalGenerator::ClearGeneratorTargets()
delete i->second; delete i->second;
} }
this->GeneratorTargets.clear(); this->GeneratorTargets.clear();
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
li = this->EvaluationFiles.begin();
li != this->EvaluationFiles.end();
++li)
{
delete *li;
}
this->EvaluationFiles.clear();
for(std::map<std::string, cmExportBuildFileGenerator*>::iterator
i = this->BuildExportSets.begin();
i != this->BuildExportSets.end(); ++i)
{
delete i->second;
}
this->BuildExportSets.clear();
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
delete this->LocalGenerators[i];
}
this->LocalGenerators.clear();
this->ExportSets.clear();
this->TargetDependencies.clear();
this->TotalTargets.clear();
this->ImportedTargets.clear();
this->LocalGeneratorToTargetMap.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
this->BinaryDirectories.clear();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -414,9 +414,10 @@ private:
cmGeneratorTargetsType GeneratorTargets; cmGeneratorTargetsType GeneratorTargets;
void CreateGeneratorTargets(); void CreateGeneratorTargets();
void ComputeGeneratorTargetObjects(); void ComputeGeneratorTargetObjects();
void ClearGeneratorTargets();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void ClearGeneratorMembers();
// Cache directory content and target files to be built. // Cache directory content and target files to be built.
struct DirectoryContent: public std::set<cmStdString> struct DirectoryContent: public std::set<cmStdString>
{ {