From 0a3aa12962e47db2421ad09d149118b920e404c8 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Fri, 22 Feb 2019 12:01:04 +0100 Subject: [PATCH] Clang: Follow symbol with Ctrl+click on invalid cursors When cursor is invalid try to follow it with built-in code model and highlight the token in case of success. Fixes: QTCREATORBUG-21637 Change-Id: I4c765882817fa150a155074c9d71beceb5905af8 Reviewed-by: Nikolai Kosjar --- .../clangcodemodel/clangfollowsymbol.cpp | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp index 96df23ab20a..f1113de164d 100644 --- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp +++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -183,12 +184,22 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data, return processLinkCallback(Utils::Link()); if (!resolveTarget) { - processLinkCallback(linkAtCursor(cursor, - data.filePath().toString(), - static_cast(line), - static_cast(column), - processor)); - return; + Utils::Link link = linkAtCursor(cursor, + data.filePath().toString(), + static_cast(line), + static_cast(column), + processor); + if (link == Utils::Link()) { + CppTools::FollowSymbolUnderCursor followSymbol; + return followSymbol.findLink(data, + std::move(processLinkCallback), + false, + snapshot, + documentFromSemanticInfo, + symbolFinder, + inNextSplit); + } + return processLinkCallback(link); } QFuture infoFuture