ProjectExplorer: Fix link generation for "note:" msvc compile output

We need to generate two sets of linkspecs in order to correctly mark
paths as links in the compile output _and_ the details text of the task
entry.

Change-Id: Ibb4ce89b8104f5edb1f1e45afa27cbd6c3ef5683
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-02-01 13:21:58 +01:00
parent 7fbb41c10c
commit 9c9e87d509

View File

@@ -149,13 +149,14 @@ MsvcParser::Result MsvcParser::processCompileLine(const QString &line)
if (match.hasMatch()) { if (match.hasMatch()) {
QPair<FilePath, int> position = parseFileName(match.captured(1)); QPair<FilePath, int> position = parseFileName(match.captured(1));
const FilePath filePath = absoluteFilePath(position.first); const FilePath filePath = absoluteFilePath(position.first);
LinkSpecs linkSpecs; LinkSpecs lineLinkSpecs;
addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, position.second, match, 1); addLinkSpecForAbsoluteFilePath(lineLinkSpecs, filePath, position.second, match, 1);
LinkSpecs detailsLinkSpecs = lineLinkSpecs;
if (!m_lastTask.isNull() && line.contains("note: ")) { if (!m_lastTask.isNull() && line.contains("note: ")) {
const int offset = std::accumulate(m_lastTask.details.cbegin(), const int offset = std::accumulate(m_lastTask.details.cbegin(),
m_lastTask.details.cend(), 0, m_lastTask.details.cend(), 0,
[](int total, const QString &line) { return total + line.length() + 1;}); [](int total, const QString &line) { return total + line.length() + 1;});
for (LinkSpec &ls : linkSpecs) for (LinkSpec &ls : detailsLinkSpecs)
ls.startPos += offset; ls.startPos += offset;
++m_lines; ++m_lines;
} else { } else {
@@ -165,9 +166,9 @@ MsvcParser::Result MsvcParser::processCompileLine(const QString &line)
filePath, position.second); filePath, position.second);
m_lines = 1; m_lines = 1;
} }
m_linkSpecs << linkSpecs; m_linkSpecs << detailsLinkSpecs;
m_lastTask.details.append(line); m_lastTask.details.append(line);
return {Status::InProgress, linkSpecs}; return {Status::InProgress, lineLinkSpecs};
} }
flush(); flush();