mirror of
https://github.com/reactos/CMake.git
synced 2024-12-03 09:00:42 +00:00
Merge topic 'perf-targetIter-missedGenerators'
7bc65770
Performance: Fix a few more unnecessary vector copies missed inaf3fd6f
Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1157
This commit is contained in:
commit
9a0a6f91ae
@ -260,7 +260,7 @@ void cmGlobalGhsMultiGenerator::Generate()
|
||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
|
||||
cmLocalGhsMultiGenerator* lg =
|
||||
static_cast<cmLocalGhsMultiGenerator*>(this->LocalGenerators[i]);
|
||||
std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
|
||||
this->UpdateBuildFiles(tgts);
|
||||
}
|
||||
}
|
||||
@ -436,9 +436,9 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath(
|
||||
}
|
||||
|
||||
void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
|
||||
std::vector<cmGeneratorTarget*> tgts)
|
||||
const std::vector<cmGeneratorTarget*>& tgts)
|
||||
{
|
||||
for (std::vector<cmGeneratorTarget*>::iterator tgtsI = tgts.begin();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator tgtsI = tgts.begin();
|
||||
tgtsI != tgts.end(); ++tgtsI) {
|
||||
const cmGeneratorTarget* tgt = *tgtsI;
|
||||
if (IsTgtForBuild(tgt)) {
|
||||
|
@ -116,7 +116,7 @@ private:
|
||||
std::vector<cmsys::String>::const_iterator end,
|
||||
GhsMultiGpj::Types projType);
|
||||
static std::string GetFileNameFromPath(std::string const& path);
|
||||
void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts);
|
||||
void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts);
|
||||
bool IsTgtForBuild(const cmGeneratorTarget* tgt);
|
||||
|
||||
std::vector<cmGeneratedFileStream*> TargetSubProjects;
|
||||
|
@ -320,10 +320,10 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
|
||||
cmGlobalVisualStudio7Generator::AddExtraIDETargets();
|
||||
if (this->AddCheckTarget()) {
|
||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
|
||||
std::vector<cmGeneratorTarget*> tgts =
|
||||
const std::vector<cmGeneratorTarget*>& tgts =
|
||||
this->LocalGenerators[i]->GetGeneratorTargets();
|
||||
// All targets depend on the build-system check target.
|
||||
for (std::vector<cmGeneratorTarget*>::iterator ti = tgts.begin();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
|
||||
ti != tgts.end(); ++ti) {
|
||||
if ((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
|
||||
(*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
|
||||
|
@ -82,8 +82,10 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
|
||||
// Now make all targets depend on the ALL_BUILD target
|
||||
for (std::vector<cmLocalGenerator*>::iterator i = gen.begin();
|
||||
i != gen.end(); ++i) {
|
||||
std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
|
||||
const std::vector<cmGeneratorTarget*>& targets =
|
||||
(*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator t =
|
||||
targets.begin();
|
||||
t != targets.end(); ++t) {
|
||||
cmGeneratorTarget* tgt = *t;
|
||||
if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
|
||||
@ -298,8 +300,10 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
|
||||
std::vector<cmLocalGenerator*>& gen = it->second;
|
||||
for (std::vector<cmLocalGenerator*>::iterator i = gen.begin();
|
||||
i != gen.end(); ++i) {
|
||||
std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
|
||||
const std::vector<cmGeneratorTarget*>& targets =
|
||||
(*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator ti =
|
||||
targets.begin();
|
||||
ti != targets.end(); ++ti) {
|
||||
this->ComputeVSTargetDepends(*ti);
|
||||
}
|
||||
|
@ -440,8 +440,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++) {
|
||||
cmGeneratorTarget* target = *l;
|
||||
|
||||
@ -925,12 +925,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
||||
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
|
||||
{
|
||||
this->SetCurrentLocalGenerator(gen);
|
||||
std::vector<cmGeneratorTarget*> tgts =
|
||||
const std::vector<cmGeneratorTarget*>& tgts =
|
||||
this->CurrentLocalGenerator->GetGeneratorTargets();
|
||||
typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
|
||||
cmSortedTargets;
|
||||
cmSortedTargets sortedTargets;
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++) {
|
||||
sortedTargets[(*l)->GetName()] = *l;
|
||||
}
|
||||
@ -1210,7 +1210,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
||||
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
|
||||
{
|
||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
|
||||
std::vector<cmGeneratorTarget*> tgts =
|
||||
const std::vector<cmGeneratorTarget*>& tgts =
|
||||
this->LocalGenerators[i]->GetGeneratorTargets();
|
||||
// All targets depend on the build-system check target.
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
|
||||
@ -2706,8 +2706,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(
|
||||
i != generators.end(); ++i) {
|
||||
cmMakefile* mf = (*i)->GetMakefile();
|
||||
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
|
||||
std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++) {
|
||||
cmGeneratorTarget* gtgt = *l;
|
||||
|
||||
|
@ -20,9 +20,9 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
|
||||
|
||||
void cmLocalGhsMultiGenerator::Generate()
|
||||
{
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
|
||||
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); ++l) {
|
||||
if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
continue;
|
||||
|
@ -60,8 +60,8 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
|
||||
void cmLocalVisualStudio10Generator::Generate()
|
||||
{
|
||||
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); ++l) {
|
||||
if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
continue;
|
||||
|
@ -62,8 +62,8 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
|
||||
void cmLocalVisualStudio7Generator::AddHelperCommands()
|
||||
{
|
||||
// Now create GUIDs for targets
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); ++l) {
|
||||
if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
continue;
|
||||
@ -91,8 +91,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
|
||||
// specification source changes.
|
||||
if (cmSourceFile* sf = this->CreateVCProjBuildRule()) {
|
||||
// Add the rule to targets that need it.
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts =
|
||||
this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); ++l) {
|
||||
if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) {
|
||||
continue;
|
||||
@ -110,8 +111,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
|
||||
// Visual Studio .NET 2003 Service Pack 1 will not run post-build
|
||||
// commands for targets in which no sources are built. Add dummy
|
||||
// rules to force these targets to build.
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++) {
|
||||
if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) {
|
||||
std::vector<std::string> no_depends;
|
||||
@ -150,10 +151,10 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
|
||||
}
|
||||
|
||||
// Get the set of targets in this directory.
|
||||
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
|
||||
const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
|
||||
|
||||
// Create the project file for each target.
|
||||
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++) {
|
||||
if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
continue;
|
||||
|
@ -42,8 +42,8 @@ void cmLocalXCodeGenerator::Generate()
|
||||
{
|
||||
cmLocalGenerator::Generate();
|
||||
|
||||
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
|
||||
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
|
||||
iter != targets.end(); ++iter) {
|
||||
(*iter)->HasMacOSXRpathInstallNameDir("");
|
||||
}
|
||||
@ -53,8 +53,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
|
||||
{
|
||||
cmLocalGenerator::GenerateInstallRules();
|
||||
|
||||
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
|
||||
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
|
||||
for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
|
||||
iter != targets.end(); ++iter) {
|
||||
(*iter)->HasMacOSXRpathInstallNameDir("");
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ static Json::Value DumpTargetsList(
|
||||
|
||||
std::vector<cmGeneratorTarget*> targetList;
|
||||
for (const auto& lgIt : generators) {
|
||||
auto list = lgIt->GetGeneratorTargets();
|
||||
const auto& list = lgIt->GetGeneratorTargets();
|
||||
targetList.insert(targetList.end(), list.begin(), list.end());
|
||||
}
|
||||
std::sort(targetList.begin(), targetList.end());
|
||||
|
Loading…
Reference in New Issue
Block a user