Merge branch 'backport-revert-server-target-backtraces' into revert-server-target-backtraces

This commit is contained in:
Brad King
2017-12-06 11:49:52 -05:00
4 changed files with 13 additions and 94 deletions

View File

@@ -517,9 +517,6 @@ Each target object can have the following keys:
with the sysroot path.
"fileGroups"
contains the source files making up the target.
"crossReferences"
contains the location of the target in the corresponding CMakeLists.txt
file and the locations of the related statements like "target_link_libraries"
FileGroups are used to group sources using similar settings together.
@@ -545,16 +542,6 @@ Each fileGroup object may contain the following keys:
All file paths in the fileGroup are either absolute or relative to the
sourceDirectory of the target.
CrossReferences object is used to report the location of the target (including
the entire call stack if the target is defined in a function) and the related
"target_link_libraries", "target_include_directories", "target_compile_definitions"
and "target_compile_options" statements.
See the example below for details on the internal format of the "crossReferences" object.
Line numbers stated in the "backtrace" entries are 1-based. The last entry of a backtrace
is a special entry with missing "line" and "name" fields that specifies the initial
CMakeLists.txt file.
Example::
[== "CMake Server" ==[
@@ -591,34 +578,7 @@ CMake will reply::
"linkerLanguage": "C",
"name": "cmForm",
"sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form",
"type": "STATIC_LIBRARY",
"crossReferences": {
"backtrace": [
{
"line": 7,
"name": "add_executable",
"path": "C:/full/path/CMakeLists.txt"
},
{
"path": "c:/full/path/CMakeLists.txt"
}
],
"relatedStatements": [
{
"backtrace": [
{
"line": 8,
"name": "target_link_libraries",
"path": "c:/full/path/CMakeLists.txt"
},
{
"path": "c:/full/path/CMakeLists.txt"
}
],
"type": "target_link_libraries"
}
]
}
"type": "STATIC_LIBRARY"
}
]
},

View File

@@ -255,3 +255,15 @@ Other Changes
incompatible with the old behavior, it is expected that behavior
under typical use cases with properly-quoted command-lines has
not changed.
Updates
=======
Changes made since CMake 3.10.0 include the following.
3.10.1
------
* The :manual:`cmake-server(7)` ``codemodel`` response ``crossReferences``
field added by 3.10.0 has been dropped due to excessive memory usage.
Another approach will be needed to provide backtrace information.

View File

@@ -97,11 +97,6 @@ static const std::string kCTEST_INFO = "ctestInfo";
static const std::string kMINIMUM_CMAKE_VERSION = "minimumCMakeVersion";
static const std::string kIS_GENERATOR_PROVIDED_KEY = "isGeneratorProvided";
static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences";
static const std::string kLINE_NUMBER_KEY = "line";
static const std::string kBACKTRACE_KEY = "backtrace";
static const std::string kRELATED_STATEMENTS_KEY = "relatedStatements";
static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==[";
static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]";

View File

@@ -11,7 +11,6 @@
#include "cmInstallGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmProperty.h"
@@ -744,37 +743,6 @@ static Json::Value DumpSourceFilesList(
return result;
}
static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace)
{
Json::Value result = Json::arrayValue;
cmListFileBacktrace backtraceCopy = backtrace;
while (!backtraceCopy.Top().FilePath.empty()) {
Json::Value entry = Json::objectValue;
entry[kPATH_KEY] = backtraceCopy.Top().FilePath;
if (backtraceCopy.Top().Line) {
entry[kLINE_NUMBER_KEY] = static_cast<int>(backtraceCopy.Top().Line);
}
if (!backtraceCopy.Top().Name.empty()) {
entry[kNAME_KEY] = backtraceCopy.Top().Name;
}
result.append(entry);
backtraceCopy = backtraceCopy.Pop();
}
return result;
}
static void DumpBacktraceRange(Json::Value& result, const std::string& type,
cmBacktraceRange range)
{
for (auto const& bt : range) {
Json::Value obj = Json::objectValue;
obj[kTYPE_KEY] = type;
obj[kBACKTRACE_KEY] = DumpBacktrace(bt);
result.append(obj);
}
}
static Json::Value DumpCTestInfo(cmTest* testInfo)
{
Json::Value result = Json::objectValue;
@@ -930,22 +898,6 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
result[kINSTALL_PATHS] = installPaths;
}
Json::Value crossRefs = Json::objectValue;
crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace());
Json::Value statements = Json::arrayValue;
DumpBacktraceRange(statements, "target_compile_definitions",
target->Target->GetCompileDefinitionsBacktraces());
DumpBacktraceRange(statements, "target_include_directories",
target->Target->GetIncludeDirectoriesBacktraces());
DumpBacktraceRange(statements, "target_compile_options",
target->Target->GetCompileOptionsBacktraces());
DumpBacktraceRange(statements, "target_link_libraries",
target->Target->GetLinkImplementationBacktraces());
crossRefs[kRELATED_STATEMENTS_KEY] = std::move(statements);
result[kTARGET_CROSS_REFERENCES_KEY] = std::move(crossRefs);
if (target->HaveWellDefinedOutputFiles()) {
Json::Value artifacts = Json::arrayValue;
artifacts.append(