From 5f3a34335224f0aba885bd3fad5cb28d7c73f23e Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 7 Aug 2024 12:26:58 +0200 Subject: [PATCH] CMakePM: Show the target callstack in top order In Projects view you can right click on a CMake target and select "Open...", in the context menu you will have a stack of functions that were used in the creation of the target. If you are using a custom CMake API you would want the highlevel function on top, and not on bottom. Task-number: QTCREATORBUG-31362 Change-Id: I42e436d99f6c5f7a8d1cd67da84a6087bc18e8cd Reviewed-by: Marcus Tillmanns --- src/plugins/cmakeprojectmanager/fileapidataextractor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index 2dbdd0b2795..d65dbac18a2 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -913,13 +913,13 @@ static void setupLocationInfoForTargets(const QFuture &cancelFuture, QSet> locations; auto dedup = [&locations](const Backtrace &bt) { QVector result; - for (const FolderNode::LocationInfo &i : bt) { + Utils::reverseForeach(bt, [&](const FolderNode::LocationInfo &i) { int count = locations.count(); locations.insert({i.path, i.line}); if (count != locations.count()) { result.append(i); } - } + }); return result; };