From a77a165f0d4cd1a8b56c41e68c96f793c66e2a62 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 29 May 2019 10:11:14 +0000 Subject: [PATCH] [Index] Correctly set symbol kind of IndirectFieldDecl Summary: The kind has been 'unknown' before, now it is 'field'. Reviewers: kadircet Reviewed By: kadircet Subscribers: jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62573 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361941 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexSymbol.cpp | 1 + test/Index/index-anonymous-union-fields.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/Index/index-anonymous-union-fields.cpp diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp index a8f11b3448..db397b9856 100644 --- a/lib/Index/IndexSymbol.cpp +++ b/lib/Index/IndexSymbol.cpp @@ -168,6 +168,7 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { Info.Kind = SymbolKind::Function; break; case Decl::Field: + case Decl::IndirectField: Info.Kind = SymbolKind::Field; if (const CXXRecordDecl * CXXRec = dyn_cast(D->getDeclContext())) { diff --git a/test/Index/index-anonymous-union-fields.cpp b/test/Index/index-anonymous-union-fields.cpp new file mode 100644 index 0000000000..30f254d110 --- /dev/null +++ b/test/Index/index-anonymous-union-fields.cpp @@ -0,0 +1,10 @@ +struct X { + union { + void *a; + }; +}; + +// RUN: c-index-test -index-file %s > %t +// RUN: FileCheck %s -input-file=%t + +// CHECK: [indexDeclaration]: kind: field | name: a | {{.*}} | loc: 3:11 -- 2.40.0