summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a86559e)
raw | patch | inline | side by side (parent: a86559e)
author | Chris Lattner <sabre@nondot.org> | |
Sun, 11 Feb 2007 08:22:15 +0000 (08:22 +0000) | ||
committer | Chris Lattner <sabre@nondot.org> | |
Sun, 11 Feb 2007 08:22:15 +0000 (08:22 +0000) |
include/llvm/ADT/StringMap.h | patch | blob | history | |
lib/Support/StringMap.cpp | patch | blob | history |
index 1865e7f48a3f433bbeb028d57c4813fe9e61203d..52982589f792b142b8b82afb93c62e475e183902 100644 (file)
unsigned getKeyLength() const { return StrLen; }
};
-/// StringMapVisitor - Subclasses of this class may be implemented to walk all
-/// of the items in a StringMap.
-class StringMapVisitor {
-public:
- virtual ~StringMapVisitor();
- virtual void Visit(const char *Key, StringMapEntryBase *Value) const = 0;
-};
-
/// StringMapImpl - This is the base class of StringMap that is shared among
/// all of its instantiations.
class StringMapImpl {
bool empty() const { return NumItems == 0; }
unsigned size() const { return NumItems; }
-
- void VisitEntries(const StringMapVisitor &Visitor) const;
};
/// StringMapEntry - This is used to represent one value that is inserted into
index d56d1da6647ce957d4069f67f26319f4fabf5409..5a3896424e72474ce4776757e303e9d3550915d8 100644 (file)
#include <cassert>
using namespace llvm;
-StringMapVisitor::~StringMapVisitor() {
-}
-
StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) {
assert((InitSize & (InitSize-1)) == 0 &&
"Init Size must be a power of 2 or zero!");
TheTable = NewTableArray;
NumBuckets = NewSize;
}
-
-
-/// VisitEntries - This method walks through all of the items,
-/// invoking Visitor.Visit for each of them.
-void StringMapImpl::VisitEntries(const StringMapVisitor &Visitor) const {
- for (ItemBucket *IB = TheTable, *E = TheTable+NumBuckets; IB != E; ++IB) {
- if (StringMapEntryBase *Id = IB->Item)
- Visitor.Visit((char*)Id + ItemSize, Id);
- }
-}