[clang] [NFC][Tooling] Remove getParentTypeLoc from RenameLocFinder (PR #249060)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 17:46:41 PST 2026


https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/249060

>From 46a7a8d66987ab315af46e9e967c56fd6207d86a Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Fri, 4 Dec 2026 12:09:26 -0800
Subject: [PATCH] [NFC][Tooling] Remove getParentTypeLoc from RenameLocFinder

getParentTypeLoc has a dangling pointer issue but it is a private member and is
not used, so this change will just remove it. The code is almost ten years old.
---
 clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp b/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
index c9108fc299cc17..9b9fabeba7d5fe 100644
--- a/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
+++ b/clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
@@ -500,16 +500,6 @@ class RenameLocFinder : public RecursiveASTVisitor<RenameLocFinder> {
     return getClosestAncestorDecl(Parents[0]);
   }
 
-  // Get the parent typeLoc of a given typeLoc. If there is no such parent,
-  // return nullptr.
-  const TypeLoc *getParentTypeLoc(TypeLoc Loc) const {
-    auto Parents = Context.getParents(Loc);
-    // FIXME: figure out how to handle it when there are multiple parents.
-    if (Parents.size() != 1)
-      return nullptr;
-    return Parents[0].get<TypeLoc>();
-  }
-
   // Check whether the USR of a given Decl is in the USRSet.
   bool isInUSRSet(const Decl *Decl) const {
     auto USR = getUSRForDecl(Decl);



More information about the cfe-commits mailing list