]> granicus.if.org Git - llvm/commit
Improve StringMap iterator support.
authorZachary Turner <zturner@google.com>
Tue, 21 Mar 2017 20:27:36 +0000 (20:27 +0000)
committerZachary Turner <zturner@google.com>
Tue, 21 Mar 2017 20:27:36 +0000 (20:27 +0000)
commit26bdd1d11224e4abe54e7a5a19df853d0e21f372
tree6936906d1c4b61cc3e38c94099c6a3028ece94ec
parentbf2f3949e7b4c0e5efa51c66cfb95c1b75b6ac92
Improve StringMap iterator support.

StringMap's iterators did not support LLVM's
iterator_facade_base, which made it unusable in various
STL algorithms or with some of our range adapters.
This patch makes both StringMapConstIterator as well as
StringMapIterator support iterator_facade_base.

With this in place, it is easy to make an iterator adapter
that iterates over only keys, and whose value_type is
StringRef.  So I add StringMapKeyIterator as well, and
provide the method StringMap::keys() that returns a
range that can be iterated.

Differential Revision: https://reviews.llvm.org/D31171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298436 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/STLExtras.h
include/llvm/ADT/StringMap.h
unittests/ADT/StringMapTest.cpp