summaryrefslogtreecommitdiffstats
path: root/Source/cmFileAPICodemodel.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-11 15:19:38 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-16 15:24:28 (GMT)
commit415ead81533ead72fca8a495c3cbc17e2bf4e400 (patch)
tree58d71c03dea5a3ee4af3649264cb2a25604af0e2 /Source/cmFileAPICodemodel.cxx
parentf73b6879e9f93157bc3bec26ee319cf67e6b026a (diff)
downloadCMake-415ead81533ead72fca8a495c3cbc17e2bf4e400.zip
CMake-415ead81533ead72fca8a495c3cbc17e2bf4e400.tar.gz
CMake-415ead81533ead72fca8a495c3cbc17e2bf4e400.tar.bz2
cmFileAPICodemodel: Build map from each target to its index
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r--Source/cmFileAPICodemodel.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 9061109..596edd1 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -46,6 +46,9 @@
namespace {
+using TargetIndexMapType =
+ std::unordered_map<cmGeneratorTarget const*, Json::ArrayIndex>;
+
class Codemodel
{
cmFileAPI& FileAPI;
@@ -94,6 +97,8 @@ class CodemodelConfig
ProjectMap;
std::vector<Project> Projects;
+ TargetIndexMapType TargetIndexMap;
+
void ProcessDirectories();
Json::ArrayIndex GetDirectoryIndex(cmLocalGenerator const* lg);
@@ -663,6 +668,8 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
target["projectIndex"] = pi;
this->Projects[pi].TargetIndexes.append(ti);
+ this->TargetIndexMap[gt] = ti;
+
return target;
}