Skip to content

Commit 7a7c90a

Browse files
committed
[Index] Skip adding call relations to deduction guides
Deduction guides have no name and we already skip adding occurrences to them for that reason. Also skip adding any relations to them. Resolves rdar://142421120. (cherry picked from commit 88c7f03)
1 parent 8d8a922 commit 7a7c90a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang/lib/Index/IndexBody.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
130130

131131
void addCallRole(SymbolRoleSet &Roles,
132132
SmallVectorImpl<SymbolRelation> &Relations) {
133+
if (isa<CXXDeductionGuideDecl>(ParentDC))
134+
return;
135+
133136
Roles |= (unsigned)SymbolRole::Call;
134137
if (auto *FD = dyn_cast<FunctionDecl>(ParentDC))
135138
Relations.emplace_back((unsigned)SymbolRole::RelationCalledBy, FD);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: c-index-test core -print-source-symbols -- %s -std=gnu++17 | FileCheck %s
2+
3+
template<typename T>
4+
typename T::type declval() {}
5+
template <typename T> struct Test;
6+
template <typename C, typename T = decltype(declval<C>().d())> Test(C &) -> Test<T>;
7+
// CHECK: [[@LINE-1]]:45 | function/C | declval
8+
// CHECK-NOT: RelCall
9+
// CHECK: [[@LINE-3]]:77 | struct(Gen)/C++ | Test
10+
// CHECK: [[@LINE-4]]:64 | struct(Gen)/C++ | Test

0 commit comments

Comments
 (0)