diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/clangbackend/source/clangfollowsymbol.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/clangbackend/source/clangfollowsymbol.cpp b/src/tools/clangbackend/source/clangfollowsymbol.cpp index 2dcdca4bef..b32b71573e 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 |