[llvm] 13647d8 - [ADT] Refactor DenseSet::insert (NFC) (#157324)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 7 10:39:42 PDT 2025
Author: Kazu Hirata
Date: 2025-09-07T10:39:38-07:00
New Revision: 13647d82eb841ff4981707f1b1cc120517f9880d
URL: https://github.com/llvm/llvm-project/commit/13647d82eb841ff4981707f1b1cc120517f9880d
DIFF: https://github.com/llvm/llvm-project/commit/13647d82eb841ff4981707f1b1cc120517f9880d.diff
LOG: [ADT] Refactor DenseSet::insert (NFC) (#157324)
DenseMap::try_emplace can default-construct DenseSetEmptyKey, so we
don't need to pass Empty on our own.
Added:
Modified:
llvm/include/llvm/ADT/DenseSet.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/DenseSet.h b/llvm/include/llvm/ADT/DenseSet.h
index 8ba74f6b9f746..281d4d1c78cc0 100644
--- a/llvm/include/llvm/ADT/DenseSet.h
+++ b/llvm/include/llvm/ADT/DenseSet.h
@@ -192,13 +192,11 @@ class DenseSetImpl {
void erase(const_iterator CI) { return TheMap.erase(CI.I); }
std::pair<iterator, bool> insert(const ValueT &V) {
- detail::DenseSetEmpty Empty;
- return TheMap.try_emplace(V, Empty);
+ return TheMap.try_emplace(V);
}
std::pair<iterator, bool> insert(ValueT &&V) {
- detail::DenseSetEmpty Empty;
- return TheMap.try_emplace(std::move(V), Empty);
+ return TheMap.try_emplace(std::move(V));
}
/// Alternative version of insert that uses a
diff erent (and possibly less
More information about the llvm-commits
mailing list