[llvm] bf83bbf - [SlotIndexes] Make IndexListEntry/slot constructor private

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 19:53:16 PST 2026


Author: Aiden Grossman
Date: 2026-02-21T03:53:07Z
New Revision: bf83bbf9d75f2107c05ed1f5f4b7833d4081748e

URL: https://github.com/llvm/llvm-project/commit/bf83bbf9d75f2107c05ed1f5f4b7833d4081748e
DIFF: https://github.com/llvm/llvm-project/commit/bf83bbf9d75f2107c05ed1f5f4b7833d4081748e.diff

LOG: [SlotIndexes] Make IndexListEntry/slot constructor private

This was made public only for some unit tests introduced in
e5e3dccd0741c2cf6e1885f0b6053fcfc6684102 that have now been removed.
Since they have been removed, make the method private to prevent misuse,
remove the warning now that misuse is prevented by visibility, and
remove the description of the destructor given it is redundant with the
code.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/SlotIndexes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/SlotIndexes.h b/llvm/include/llvm/CodeGen/SlotIndexes.h
index 780bd82a4c624..6d897e427cf79 100644
--- a/llvm/include/llvm/CodeGen/SlotIndexes.h
+++ b/llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -92,6 +92,8 @@ class raw_ostream;
 
     PointerIntPair<IndexListEntry*, 2, unsigned> lie;
 
+    SlotIndex(IndexListEntry *entry, unsigned slot) : lie(entry, slot) {}
+
     IndexListEntry* listEntry() const {
       assert(isValid() && "Attempt to compare reserved index.");
       return lie.getPointer();
@@ -116,11 +118,6 @@ class raw_ostream;
     /// Construct an invalid index.
     SlotIndex() = default;
 
-    // Creates a SlotIndex from an IndexListEntry and a slot. Generally should
-    // not be used. This method is only public to facilitate writing certain
-    // unit tests.
-    SlotIndex(IndexListEntry *entry, unsigned slot) : lie(entry, slot) {}
-
     // Construct a new slot index from the given one, and set the slot.
     SlotIndex(const SlotIndex &li, Slot s) : lie(li.listEntry(), unsigned(s)) {
       assert(isValid() && "Attempt to construct index with 0 pointer.");


        


More information about the llvm-commits mailing list