]> granicus.if.org Git - clang/commitdiff
[Index] Correctly set symbol kind of IndirectFieldDecl
authorIlya Biryukov <ibiryukov@google.com>
Wed, 29 May 2019 10:11:14 +0000 (10:11 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 29 May 2019 10:11:14 +0000 (10:11 +0000)
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
test/Index/index-anonymous-union-fields.cpp [new file with mode: 0644]

index a8f11b34486d09dcc65bee6f7834e3b68d131a1d..db397b9856136035b5f7a42f80f5d8972faa1fa6 100644 (file)
@@ -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<CXXRecordDecl>(D->getDeclContext())) {
diff --git a/test/Index/index-anonymous-union-fields.cpp b/test/Index/index-anonymous-union-fields.cpp
new file mode 100644 (file)
index 0000000..30f254d
--- /dev/null
@@ -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