diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp index f503a777d2a..6611b66d82f 100644 --- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp +++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp @@ -135,8 +135,10 @@ static Utils::Link linkAtCursor(const QTextCursor &cursor, return token; } - if (mark.extraInfo.identifier || mark.extraInfo.token == "operator") + if (mark.extraInfo.identifier || mark.extraInfo.token == "operator" + || mark.extraInfo.token == "auto") { return token; + } return Link(); } diff --git a/src/tools/clangbackend/source/clangfollowsymbol.cpp b/src/tools/clangbackend/source/clangfollowsymbol.cpp index 2dcdca4bef8..b32b71573e1 100644 --- a/src/tools/clangbackend/source/clangfollowsymbol.cpp +++ b/src/tools/clangbackend/source/clangfollowsymbol.cpp @@ -151,8 +151,17 @@ FollowSymbolResult FollowSymbol::followSymbol(CXTranslationUnit tu, } // For definitions we can always find a declaration in current TU - if (cursor.isDefinition()) + if (cursor.isDefinition()) { + if (tokenSpelling == "auto") { + Type type = cursor.type().pointeeType(); + if (!type.isValid()) + type = cursor.type(); + const Cursor declCursor = type.declaration(); + return extractMatchingTokenRange(declCursor, declCursor.spelling()); + } + return extractMatchingTokenRange(cursor.canonical(), tokenSpelling); + } if (!cursor.isDeclaration()) { // This is the symbol usage