From 9c9e87d50903117d4fd188c524b5fe96654a9183 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 1 Feb 2023 13:21:58 +0100 Subject: [PATCH] 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: Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/msvcparser.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index a19ad120078..89c59443e1b 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -149,13 +149,14 @@ MsvcParser::Result MsvcParser::processCompileLine(const QString &line) if (match.hasMatch()) { QPair position = parseFileName(match.captured(1)); const FilePath filePath = absoluteFilePath(position.first); - LinkSpecs linkSpecs; - addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, position.second, match, 1); + LinkSpecs lineLinkSpecs; + addLinkSpecForAbsoluteFilePath(lineLinkSpecs, filePath, position.second, match, 1); + LinkSpecs detailsLinkSpecs = lineLinkSpecs; if (!m_lastTask.isNull() && line.contains("note: ")) { const int offset = std::accumulate(m_lastTask.details.cbegin(), m_lastTask.details.cend(), 0, [](int total, const QString &line) { return total + line.length() + 1;}); - for (LinkSpec &ls : linkSpecs) + for (LinkSpec &ls : detailsLinkSpecs) ls.startPos += offset; ++m_lines; } else { @@ -165,9 +166,9 @@ MsvcParser::Result MsvcParser::processCompileLine(const QString &line) filePath, position.second); m_lines = 1; } - m_linkSpecs << linkSpecs; + m_linkSpecs << detailsLinkSpecs; m_lastTask.details.append(line); - return {Status::InProgress, linkSpecs}; + return {Status::InProgress, lineLinkSpecs}; } flush();