[clang] [Index] Skip adding call relations to deduction guides (PR #126151)

Ben Barham via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 15:27:35 PST 2025


https://github.com/bnbarham created https://github.com/llvm/llvm-project/pull/126151

Deduction guides have no name and we already skip adding occurrences to them for that reason. Also skip adding any relations to them.

>From 9c81463e356483a33df5b898e277649bf0a521c3 Mon Sep 17 00:00:00 2001
From: Ben Barham <ben_barham at apple.com>
Date: Thu, 6 Feb 2025 15:17:56 -0800
Subject: [PATCH] [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.
---
 clang/lib/Index/IndexBody.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp
index c18daf7faa74979..f1dc4d5831ce746 100644
--- a/clang/lib/Index/IndexBody.cpp
+++ b/clang/lib/Index/IndexBody.cpp
@@ -130,6 +130,9 @@ class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
 
   void addCallRole(SymbolRoleSet &Roles,
                    SmallVectorImpl<SymbolRelation> &Relations) {
+    if (isa<CXXDeductionGuideDecl>(ParentDC))
+      return;
+
     Roles |= (unsigned)SymbolRole::Call;
     if (auto *FD = dyn_cast<FunctionDecl>(ParentDC))
       Relations.emplace_back((unsigned)SymbolRole::RelationCalledBy, FD);



More information about the cfe-commits mailing list