summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-11 14:17:05 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-16 15:24:41 (GMT)
commitfd30bd93e6f4334a9cd317a1e5eb8181fffa7a42 (patch)
tree4ab5846d7b33f7e3fa0acff7845588518a562395 /Source
parent415ead81533ead72fca8a495c3cbc17e2bf4e400 (diff)
downloadCMake-fd30bd93e6f4334a9cd317a1e5eb8181fffa7a42.zip
CMake-fd30bd93e6f4334a9cd317a1e5eb8181fffa7a42.tar.gz
CMake-fd30bd93e6f4334a9cd317a1e5eb8181fffa7a42.tar.bz2
fileapi: Re-organize backtrace infrastructure
Make it available to more parts of the codemodel object.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileAPICodemodel.cxx168
1 files changed, 84 insertions, 84 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 596edd1..ed6ac8e 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -49,80 +49,6 @@ namespace {
using TargetIndexMapType =
std::unordered_map<cmGeneratorTarget const*, Json::ArrayIndex>;
-class Codemodel
-{
- cmFileAPI& FileAPI;
- unsigned long Version;
-
- Json::Value DumpPaths();
- Json::Value DumpConfigurations();
- Json::Value DumpConfiguration(std::string const& config);
-
-public:
- Codemodel(cmFileAPI& fileAPI, unsigned long version);
- Json::Value Dump();
-};
-
-class CodemodelConfig
-{
- cmFileAPI& FileAPI;
- unsigned long Version;
- std::string const& Config;
- std::string TopSource;
- std::string TopBuild;
-
- struct Directory
- {
- cmStateSnapshot Snapshot;
- cmLocalGenerator const* LocalGenerator = nullptr;
- Json::Value TargetIndexes = Json::arrayValue;
- Json::ArrayIndex ProjectIndex;
- bool HasInstallRule = false;
- };
- std::map<cmStateSnapshot, Json::ArrayIndex, cmStateSnapshot::StrictWeakOrder>
- DirectoryMap;
- std::vector<Directory> Directories;
-
- struct Project
- {
- cmStateSnapshot Snapshot;
- static const Json::ArrayIndex NoParentIndex =
- static_cast<Json::ArrayIndex>(-1);
- Json::ArrayIndex ParentIndex = NoParentIndex;
- Json::Value ChildIndexes = Json::arrayValue;
- Json::Value DirectoryIndexes = Json::arrayValue;
- Json::Value TargetIndexes = Json::arrayValue;
- };
- std::map<cmStateSnapshot, Json::ArrayIndex, cmStateSnapshot::StrictWeakOrder>
- ProjectMap;
- std::vector<Project> Projects;
-
- TargetIndexMapType TargetIndexMap;
-
- void ProcessDirectories();
-
- Json::ArrayIndex GetDirectoryIndex(cmLocalGenerator const* lg);
- Json::ArrayIndex GetDirectoryIndex(cmStateSnapshot s);
-
- Json::ArrayIndex AddProject(cmStateSnapshot s);
-
- Json::Value DumpTargets();
- Json::Value DumpTarget(cmGeneratorTarget* gt, Json::ArrayIndex ti);
-
- Json::Value DumpDirectories();
- Json::Value DumpDirectory(Directory& d);
-
- Json::Value DumpProjects();
- Json::Value DumpProject(Project& p);
-
- Json::Value DumpMinimumCMakeVersion(cmStateSnapshot s);
-
-public:
- CodemodelConfig(cmFileAPI& fileAPI, unsigned long version,
- std::string const& config);
- Json::Value Dump();
-};
-
std::string RelativeIfUnder(std::string const& top, std::string const& in)
{
std::string out;
@@ -136,16 +62,6 @@ std::string RelativeIfUnder(std::string const& top, std::string const& in)
return out;
}
-std::string TargetId(cmGeneratorTarget const* gt, std::string const& topBuild)
-{
- cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_256);
- std::string path = RelativeIfUnder(
- topBuild, gt->GetLocalGenerator()->GetCurrentBinaryDirectory());
- std::string hash = hasher.HashString(path);
- hash.resize(20, '0');
- return gt->GetName() + CMAKE_DIRECTORY_ID_SEP + hash;
-}
-
class JBTIndex
{
public:
@@ -295,6 +211,90 @@ Json::Value BacktraceData::Dump()
return backtraceGraph;
}
+class Codemodel
+{
+ cmFileAPI& FileAPI;
+ unsigned long Version;
+
+ Json::Value DumpPaths();
+ Json::Value DumpConfigurations();
+ Json::Value DumpConfiguration(std::string const& config);
+
+public:
+ Codemodel(cmFileAPI& fileAPI, unsigned long version);
+ Json::Value Dump();
+};
+
+class CodemodelConfig
+{
+ cmFileAPI& FileAPI;
+ unsigned long Version;
+ std::string const& Config;
+ std::string TopSource;
+ std::string TopBuild;
+
+ struct Directory
+ {
+ cmStateSnapshot Snapshot;
+ cmLocalGenerator const* LocalGenerator = nullptr;
+ Json::Value TargetIndexes = Json::arrayValue;
+ Json::ArrayIndex ProjectIndex;
+ bool HasInstallRule = false;
+ };
+ std::map<cmStateSnapshot, Json::ArrayIndex, cmStateSnapshot::StrictWeakOrder>
+ DirectoryMap;
+ std::vector<Directory> Directories;
+
+ struct Project
+ {
+ cmStateSnapshot Snapshot;
+ static const Json::ArrayIndex NoParentIndex =
+ static_cast<Json::ArrayIndex>(-1);
+ Json::ArrayIndex ParentIndex = NoParentIndex;
+ Json::Value ChildIndexes = Json::arrayValue;
+ Json::Value DirectoryIndexes = Json::arrayValue;
+ Json::Value TargetIndexes = Json::arrayValue;
+ };
+ std::map<cmStateSnapshot, Json::ArrayIndex, cmStateSnapshot::StrictWeakOrder>
+ ProjectMap;
+ std::vector<Project> Projects;
+
+ TargetIndexMapType TargetIndexMap;
+
+ void ProcessDirectories();
+
+ Json::ArrayIndex GetDirectoryIndex(cmLocalGenerator const* lg);
+ Json::ArrayIndex GetDirectoryIndex(cmStateSnapshot s);
+
+ Json::ArrayIndex AddProject(cmStateSnapshot s);
+
+ Json::Value DumpTargets();
+ Json::Value DumpTarget(cmGeneratorTarget* gt, Json::ArrayIndex ti);
+
+ Json::Value DumpDirectories();
+ Json::Value DumpDirectory(Directory& d);
+
+ Json::Value DumpProjects();
+ Json::Value DumpProject(Project& p);
+
+ Json::Value DumpMinimumCMakeVersion(cmStateSnapshot s);
+
+public:
+ CodemodelConfig(cmFileAPI& fileAPI, unsigned long version,
+ std::string const& config);
+ Json::Value Dump();
+};
+
+std::string TargetId(cmGeneratorTarget const* gt, std::string const& topBuild)
+{
+ cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_256);
+ std::string path = RelativeIfUnder(
+ topBuild, gt->GetLocalGenerator()->GetCurrentBinaryDirectory());
+ std::string hash = hasher.HashString(path);
+ hash.resize(20, '0');
+ return gt->GetName() + CMAKE_DIRECTORY_ID_SEP + hash;
+}
+
struct CompileData
{
struct IncludeEntry