LLVM: include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSTRINGPOOL_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSTRINGPOOL_H
16
22#include
23#include
24
25namespace llvm {
27
29 static constexpr size_t BadIndex = std::numeric_limits<size_t>::max();
33 TableType StringTable;
34 std::vector<ValueType *> Entries;
35
36public:
41
42 bool isValidIndex(size_t Index) const { return Index != BadIndex; }
43
44
45
46
47 size_t getSize() const { return Entries.size() - 1; }
48
49
52 if (Iter != StringTable.end())
53 return Iter->second;
54 return BadIndex;
55 }
56
57
61 return Index;
62 size_t Value = Entries.size();
64 StringTable.insert(Entry);
65 Entries.push_back(Entry);
67 }
68
69
71 return (Index >= Entries.size()) ? StringRef() : Entries[Index]->getKey();
72 }
73
75 if (!Entries.empty()) {
76 OS << "\nString Pool:\n";
77 for (const ValueType *Entry : Entries)
78 OS << "Index: " << Entry->getValue() << ", "
79 << "Key: '" << Entry->getKey() << "'\n";
80 }
81 }
82
83#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
85#endif
86};
87
88}
89}
90
91#endif
This file defines the StringMap class.
This file defines the BumpPtrAllocator interface.
static StringMapEntry * create(StringRef key, AllocatorTy &allocator, InitTy &&...initVals)
Create a StringMapEntry for the specified key construct the value using InitiVals.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringMapEntry< size_t > value_type
StringMapIterBase< size_t, true > const_iterator
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
bool isValidIndex(size_t Index) const
Definition LVStringPool.h:42
size_t findIndex(StringRef Key) const
Definition LVStringPool.h:50
LVStringPool()
Definition LVStringPool.h:37
void print(raw_ostream &OS) const
Definition LVStringPool.h:74
void dump() const
Definition LVStringPool.h:84
LVStringPool(LVStringPool const &other)=delete
LVStringPool(LVStringPool &&other)=delete
StringRef getString(size_t Index) const
Definition LVStringPool.h:70
size_t getIndex(StringRef Key)
Definition LVStringPool.h:58
size_t getSize() const
Definition LVStringPool.h:47
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.