From da467ed444e5285008260f775022db5537ac3df4 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Wed, 12 Jul 2017 22:05:30 +0000 Subject: [index] Don't add relation to a NamedDecl with no name Unless it's one of the special cases (tag, category) that we can handle. This syncs up the check between handling a decl and handling a relation. This would cause invalid nameless decls to end up in relations despite having no name or USR. rdar://problem/32474406 llvm-svn: 307855 --- clang/test/Index/Core/index-source-invalid-name.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 clang/test/Index/Core/index-source-invalid-name.cpp (limited to 'clang/test/Index/Core/index-source-invalid-name.cpp') diff --git a/clang/test/Index/Core/index-source-invalid-name.cpp b/clang/test/Index/Core/index-source-invalid-name.cpp new file mode 100644 index 00000000000..1b4b059cd1b --- /dev/null +++ b/clang/test/Index/Core/index-source-invalid-name.cpp @@ -0,0 +1,13 @@ +// RUN: c-index-test core -print-source-symbols -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck %s + +namespace rdar32474406 { +// CHECK: [[@LINE+1]]:6 | function/C | foo | c:@N@rdar32474406@F@foo# | __ZN12rdar324744063fooEv | Decl,RelChild | rel: 1 +void foo(); +// CHECK: [[@LINE+1]]:16 | type-alias/C | Func_t | c:index-source-invalid-name.cpp@N@rdar32474406@T@Func_t | | Def,RelChild | rel: 1 +typedef void (*Func_t)(); +// CHECK: [[@LINE+4]]:1 | type-alias/C | Func_t | c:index-source-invalid-name.cpp@N@rdar32474406@T@Func_t | | Ref,RelCont | rel: 1 +// CHECK-NEXT: RelCont | rdar32474406 | c:@N@rdar32474406 +// CHECK: [[@LINE+2]]:14 | function/C | foo | c:@N@rdar32474406@F@foo# | __ZN12rdar324744063fooEv | Ref,RelCont | rel: 1 +// CHECK-NEXT: RelCont | rdar32474406 | c:@N@rdar32474406 +Func_t[] = { foo }; // invalid decomposition +} -- cgit v1.2.3