From 52bd5173fbf00428698368d4cf19bb2bf4b0332a Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Fri, 1 Jun 2018 09:22:03 +0200 Subject: [PATCH] Clang: Remove extern and static declarations from symbol outline... ... in case they appear within the function body. Task-number: QTCREATORBUG-20434 Change-Id: I6d12ab857cca5fe8479ac3fb426329ae7d732567 Reviewed-by: Orgad Shaneh Reviewed-by: Nikolai Kosjar --- src/plugins/clangcodemodel/clangoverviewmodel.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/clangcodemodel/clangoverviewmodel.cpp b/src/plugins/clangcodemodel/clangoverviewmodel.cpp index 22a2576b716..e7e5671d4b5 100644 --- a/src/plugins/clangcodemodel/clangoverviewmodel.cpp +++ b/src/plugins/clangcodemodel/clangoverviewmodel.cpp @@ -80,6 +80,17 @@ void buildTree(const TokenContainers &containers, if (lexicalParentIndex >= 0 && treeItemCache[lexicalParentIndex]) parent = treeItemCache[lexicalParentIndex]; + if (parent != root + && (container.extraInfo.storageClass == ClangBackEnd::StorageClass::Extern + || container.extraInfo.storageClass == ClangBackEnd::StorageClass::Static)) { + ClangBackEnd::HighlightingType parentType = parent->token.types.mainHighlightingType; + if (parentType == ClangBackEnd::HighlightingType::VirtualFunction + || parentType == ClangBackEnd::HighlightingType::Function) { + // Treat static and extern variables inside a function scope as local variables. + continue; + } + } + parent->appendChild(item.release()); }