[llvm] [ADT] Deprecate FoldingSet's void * insert position API (PR #219845)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 13:22:42 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
After all users have adopted the new typed API introduced by #<!-- -->219644,
deprecate the old `void *` insert position API.
---
Full diff: https://github.com/llvm/llvm-project/pull/219845.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/FoldingSet.h (+11)
``````````diff
diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h
index 77818bc151a09..047d52064273d 100644
--- a/llvm/include/llvm/ADT/FoldingSet.h
+++ b/llvm/include/llvm/ADT/FoldingSet.h
@@ -408,6 +408,7 @@ class FoldingSetBase : public DebugEpochBase {
LLVM_ABI Node *lookup(const FoldingSetNodeID &ID,
FoldingSetInsertToken &Token,
const FoldingSetInfo &Info);
+ LLVM_DEPRECATED("use lookup instead", "lookup")
LLVM_ABI Node *FindNodeOrInsertPos(const FoldingSetNodeID &ID,
void *&InsertPos,
const FoldingSetInfo &Info);
@@ -416,6 +417,7 @@ class FoldingSetBase : public DebugEpochBase {
/// already in the folding set. \p Token must come from lookup for an ID that
/// \p N profiles identically to.
LLVM_ABI void insert(Node *N, FoldingSetInsertToken Token);
+ LLVM_DEPRECATED("use insert instead", "insert")
LLVM_ABI void InsertNode(Node *N, void *InsertPos);
};
@@ -505,6 +507,7 @@ class FoldingSetImpl : public FoldingSetBase, public Trait::ContextStorage {
/// Remove a node from the folding set, returning true if one
/// was removed or false if the node was not in the folding set.
bool erase(T *N) { return FoldingSetBase::RemoveNode(N); }
+ LLVM_DEPRECATED("use erase instead", "erase")
bool RemoveNode(T *N) { return erase(N); }
/// If there is an existing node exactly equal to the specified node,
@@ -513,6 +516,7 @@ class FoldingSetImpl : public FoldingSetBase, public Trait::ContextStorage {
return static_cast<T *>(
FoldingSetBase::GetOrInsertNode(N, getFoldingSetInfo()));
}
+ LLVM_DEPRECATED("use getOrInsert instead", "getOrInsert")
T *GetOrInsertNode(T *N) { return getOrInsert(N); }
/// Look up the node specified by ID. If it exists, return it and clear
@@ -521,6 +525,7 @@ class FoldingSetImpl : public FoldingSetBase, public Trait::ContextStorage {
return static_cast<T *>(
FoldingSetBase::lookup(ID, Token, getFoldingSetInfo()));
}
+ LLVM_DEPRECATED("use lookup instead", "lookup")
T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) {
return static_cast<T *>(FoldingSetBase::FindNodeOrInsertPos(
ID, InsertPos, getFoldingSetInfo()));
@@ -532,6 +537,7 @@ class FoldingSetImpl : public FoldingSetBase, public Trait::ContextStorage {
void insert(T *N, FoldingSetInsertToken Token) {
FoldingSetBase::insert(N, Token);
}
+ LLVM_DEPRECATED("use insert instead", "insert")
void InsertNode(T *N, void *InsertPos) {
FoldingSetBase::InsertNode(N, InsertPos);
}
@@ -543,6 +549,7 @@ class FoldingSetImpl : public FoldingSetBase, public Trait::ContextStorage {
(void)Inserted;
assert(Inserted == N && "Node already inserted!");
}
+ LLVM_DEPRECATED("use insert instead", "insert")
void InsertNode(T *N) { insert(N); }
};
@@ -603,6 +610,7 @@ template <class T, class VectorT = SmallVector<T *, 8>> class FoldingSetVector {
T *lookup(const FoldingSetNodeID &ID, FoldingSetInsertToken &Token) {
return Set.lookup(ID, Token);
}
+ LLVM_DEPRECATED("use lookup instead", "lookup")
T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) {
return Set.FindNodeOrInsertPos(ID, InsertPos);
}
@@ -615,6 +623,7 @@ template <class T, class VectorT = SmallVector<T *, 8>> class FoldingSetVector {
Vector.push_back(N);
return Result;
}
+ LLVM_DEPRECATED("use getOrInsert instead", "getOrInsert")
T *GetOrInsertNode(T *N) { return getOrInsert(N); }
/// Insert the specified node into the folding set, knowing that it is not
@@ -624,6 +633,7 @@ template <class T, class VectorT = SmallVector<T *, 8>> class FoldingSetVector {
Set.insert(N, Token);
Vector.push_back(N);
}
+ LLVM_DEPRECATED("use insert instead", "insert")
void InsertNode(T *N, void *InsertPos) {
Set.InsertNode(N, InsertPos);
Vector.push_back(N);
@@ -635,6 +645,7 @@ template <class T, class VectorT = SmallVector<T *, 8>> class FoldingSetVector {
Set.insert(N);
Vector.push_back(N);
}
+ LLVM_DEPRECATED("use insert instead", "insert")
void InsertNode(T *N) { insert(N); }
/// Returns the number of nodes in the folding set.
``````````
</details>
https://github.com/llvm/llvm-project/pull/219845
More information about the llvm-commits
mailing list