Commit 8b5336df authored by Milian Wolff's avatar Milian Wolff
Browse files

Don't rely on order of items in cmake JSON response

Previously we relied on the `codemodel` item to arrive before the
`cmakeFiles` one, which could have broken arbitrarily. Instead,
introduce a separate local to detach us from the order of the
responses.

Spotted and suggested by Igor Kushnir, many thanks!
parent 5651e3d4
......@@ -252,6 +252,7 @@ CMakeProjectData parseReplyIndexFile(const ReplyIndex& replyIndex, const Path& s
CMakeProjectData codeModel;
QHash<Path, CMakeProjectData::CMakeFileFlags> cmakeFiles;
QDateTime lastModifiedCMakeFile;
for (const auto& responseValue : responses) {
const auto response = responseValue.toObject();
const auto kind = response.value(QLatin1String("kind"));
......@@ -261,7 +262,7 @@ CMakeProjectData parseReplyIndexFile(const ReplyIndex& replyIndex, const Path& s
codeModel = parseCodeModel(parseFile(jsonFilePath), replyDir,
stringInterner, sourcePathInterner, buildPathInterner);
} else if (kind == QLatin1String("cmakeFiles")) {
cmakeFiles = parseCMakeFiles(parseFile(jsonFilePath), sourcePathInterner, &codeModel.lastModifiedCMakeFile);
cmakeFiles = parseCMakeFiles(parseFile(jsonFilePath), sourcePathInterner, &lastModifiedCMakeFile);
}
}
......@@ -271,6 +272,7 @@ CMakeProjectData parseReplyIndexFile(const ReplyIndex& replyIndex, const Path& s
return {};
}
codeModel.lastModifiedCMakeFile = lastModifiedCMakeFile;
codeModel.lastModifiedProjectData = replyIndex.lastModified;
codeModel.cmakeFiles = cmakeFiles;
return codeModel;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment