[PATCH] D17923: Add getSetRef() to SetVector

don hinton via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 6 21:25:10 PST 2016


hintonda created this revision.
hintonda added reviewers: rafael, dblaikie, aaboud.
hintonda added a subscriber: llvm-commits.

Access to the underlying set implementation lets users call
methods like find, if the set implementation supports them.

See D17884 (DIImportedEntitys) for an example of when this might be
important -- need to keep a unique set, but also need the order to be
deterministic.

Switching from DenseSet to SetVector, even if the underlying set
implementation is DenseSet, isn't possible since the caller can't
check to see if the key has already been added without access to the
underlying set.

http://reviews.llvm.org/D17923

Files:
  include/llvm/ADT/SetVector.h

Index: include/llvm/ADT/SetVector.h
===================================================================
--- include/llvm/ADT/SetVector.h
+++ include/llvm/ADT/SetVector.h
@@ -60,6 +60,8 @@
 
   ArrayRef<T> getArrayRef() const { return vector_; }
 
+  const set_type& getSetRef() const { return Set; }
+
   /// \brief Determine if the SetVector is empty or not.
   bool empty() const {
     return vector_.empty();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17923.49931.patch
Type: text/x-patch
Size: 413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160307/a13408f7/attachment.bin>


More information about the llvm-commits mailing list