diff options
author | Brad King <brad.king@kitware.com> | 2014-12-03 15:01:53 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-12-03 15:01:53 (GMT) |
commit | 03b3ee7de25acac71fa37c2add32f6d431e82a41 (patch) | |
tree | 5d6654e093fac984f4eeaa0ed410133ef396baed /Source | |
parent | 72c4128176e11fbbf05a0d93bd5bda6a4f90e1b5 (diff) | |
parent | 48f78f5f9ed3a7e0717359720ecc157418f55155 (diff) | |
download | CMake-03b3ee7de25acac71fa37c2add32f6d431e82a41.zip CMake-03b3ee7de25acac71fa37c2add32f6d431e82a41.tar.gz CMake-03b3ee7de25acac71fa37c2add32f6d431e82a41.tar.bz2 |
Merge topic 'xcode-target-search-perf'
48f78f5f Xcode: use a map to look up target pointers (#15201)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 1 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b9f64e2..d222288 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -557,6 +557,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects() } this->XCodeObjects.clear(); this->XCodeObjectIDs.clear(); + this->XCodeObjectMap.clear(); this->GroupMap.clear(); this->GroupNameMap.clear(); this->TargetGroup.clear(); @@ -2458,6 +2459,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) target->AddAttribute("name", this->CreateString(cmtarget.GetName())); target->AddAttribute("productName",this->CreateString(cmtarget.GetName())); target->SetTarget(&cmtarget); + this->XCodeObjectMap[&cmtarget] = target; // Add source files without build rules for editing convenience. if(cmtarget.GetType() == cmTarget::UTILITY) @@ -2661,6 +2663,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, target->AddAttribute("productType", this->CreateString(productType)); } target->SetTarget(&cmtarget); + this->XCodeObjectMap[&cmtarget] = target; target->SetId(this->GetOrCreateId( cmtarget.GetName(), target->GetId()).c_str()); return target; @@ -2673,16 +2676,14 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) { return 0; } - for(std::vector<cmXCodeObject*>::iterator i = this->XCodeObjects.begin(); - i != this->XCodeObjects.end(); ++i) + + std::map<cmTarget const*, cmXCodeObject*>::const_iterator const i = + this->XCodeObjectMap.find(t); + if (i == this->XCodeObjectMap.end()) { - cmXCodeObject* o = *i; - if(o->GetTarget() == t) - { - return o; - } + return 0; } - return 0; + return i->second; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 9d7b784..d2bc9d1 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -241,6 +241,7 @@ private: std::map<std::string, cmXCodeObject* > GroupNameMap; std::map<std::string, cmXCodeObject* > TargetGroup; std::map<std::string, cmXCodeObject* > FileRefs; + std::map<cmTarget const*, cmXCodeObject* > XCodeObjectMap; std::vector<std::string> Architectures; std::string GeneratorToolset; }; |