[llvm] [llvm][CAS] Remove unused functions (PR #168856)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 03:15:02 PST 2025


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/168856

Building with GCC I got:
```
<...>/OnDiskGraphDB.cpp:624:18: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::construct(char*, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  624 | DataRecordHandle DataRecordHandle::construct(char *Mem, const Input &I) {
      |                  ^~~~~~~~~~~~~~~~
<...>/OnDiskGraphDB.cpp:456:1: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::create(llvm::function_ref<char*(long unsigned int)>, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  456 | DataRecordHandle::create(function_ref<char *(size_t Size)> Alloc,
      | ^~~~~~~~~~~~~~~~
```

These implement parts of a class that is defined in an anonymous namespace. All llvm tests passed with them removed.

>From 06a099294020aaae709bcc03082416d1e77ede04 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Thu, 20 Nov 2025 10:52:48 +0000
Subject: [PATCH] [llvm][CAS] Remove unused functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Building with GCC I got:
```
<...>/OnDiskGraphDB.cpp:624:18: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::construct(char*, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  624 | DataRecordHandle DataRecordHandle::construct(char *Mem, const Input &I) {
      |                  ^~~~~~~~~~~~~~~~
<...>/OnDiskGraphDB.cpp:456:1: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::create(llvm::function_ref<char*(long unsigned int)>, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  456 | DataRecordHandle::create(function_ref<char *(size_t Size)> Alloc,
      | ^~~~~~~~~~~~~~~~
```

These implement parts of a class that is defined in an anonymous namespace.
All llvm tests passed with them removed.
---
 llvm/lib/CAS/OnDiskGraphDB.cpp | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/llvm/lib/CAS/OnDiskGraphDB.cpp b/llvm/lib/CAS/OnDiskGraphDB.cpp
index 2aede017133b0..84f27c4938050 100644
--- a/llvm/lib/CAS/OnDiskGraphDB.cpp
+++ b/llvm/lib/CAS/OnDiskGraphDB.cpp
@@ -452,13 +452,6 @@ Expected<DataRecordHandle> DataRecordHandle::createWithError(
     return Mem.takeError();
 }
 
-DataRecordHandle
-DataRecordHandle::create(function_ref<char *(size_t Size)> Alloc,
-                         const Input &I) {
-  Layout L(I);
-  return constructImpl(Alloc(L.getTotalSize()), I, L);
-}
-
 ObjectHandle ObjectHandle::fromFileOffset(FileOffset Offset) {
   // Store the file offset as it is.
   assert(!(Offset.get() & 0x1));
@@ -621,10 +614,6 @@ bool TrieRecord::compare_exchange_strong(Data &Existing, Data New) {
   return false;
 }
 
-DataRecordHandle DataRecordHandle::construct(char *Mem, const Input &I) {
-  return constructImpl(Mem, I, Layout(I));
-}
-
 Expected<DataRecordHandle>
 DataRecordHandle::getFromDataPool(const OnDiskDataAllocator &Pool,
                                   FileOffset Offset) {



More information about the llvm-commits mailing list