summaryrefslogtreecommitdiff
path: root/Source/cmFileAPICodemodel.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-14 16:17:56 -0500
committerBrad King <brad.king@kitware.com>2021-03-16 16:47:55 -0400
commiteae2256a529250e4fda639a79a9edddef6604f12 (patch)
tree9f3dd3c486b0291c9e7e121196b3fb27b63bf5c5 /Source/cmFileAPICodemodel.cxx
parenta12d7f70b1b97f74293d9861a1827c88ef46ec39 (diff)
downloadcmake-eae2256a529250e4fda639a79a9edddef6604f12.tar.gz
fileapi: Add backtraceGraph to codemodel-v2 "directory" object
Co-Authored-by: Kyle Edwards <kyle.edwards@kitware.com>
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r--Source/cmFileAPICodemodel.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 2f36db2d84..e7bfc6164a 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -379,6 +379,9 @@ class DirectoryObject
std::string const& Config;
std::string TopSource;
std::string TopBuild;
+ BacktraceData Backtraces;
+
+ void AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt);
Json::Value DumpPaths();
@@ -814,6 +817,7 @@ DirectoryObject::DirectoryObject(cmLocalGenerator const* lg,
, TopSource(lg->GetGlobalGenerator()->GetCMakeInstance()->GetHomeDirectory())
, TopBuild(
lg->GetGlobalGenerator()->GetCMakeInstance()->GetHomeOutputDirectory())
+ , Backtraces(this->TopSource)
{
}
@@ -821,9 +825,18 @@ Json::Value DirectoryObject::Dump()
{
Json::Value directoryObject = Json::objectValue;
directoryObject["paths"] = this->DumpPaths();
+ directoryObject["backtraceGraph"] = this->Backtraces.Dump();
return directoryObject;
}
+void DirectoryObject::AddBacktrace(Json::Value& object,
+ cmListFileBacktrace const& bt)
+{
+ if (JBTIndex backtrace = this->Backtraces.Add(bt)) {
+ object["backtrace"] = backtrace.Index;
+ }
+}
+
Json::Value DirectoryObject::DumpPaths()
{
Json::Value paths = Json::objectValue;