16#ifndef LLVM_ADT_STRINGMAPENTRY_H
17#define LLVM_ADT_STRINGMAPENTRY_H
37 template <
typename AllocatorTy>
43template <
typename AllocatorTy>
47 size_t KeyLength = Key.size();
51 size_t AllocSize = EntrySize + KeyLength + 1;
52 void *Allocation =
Allocator.Allocate(AllocSize, EntryAlign);
53 assert(Allocation &&
"Unhandled out-of-memory");
56 char *Buffer =
reinterpret_cast<char *
>(Allocation) + EntrySize;
58 ::memcpy(Buffer, Key.data(), KeyLength);
59 Buffer[KeyLength] = 0;
68template <
typename ValueTy>
75 template <
typename... InitTy>
78 second(
std::forward<InitTy>(initVals)...) {}
91 std::nullopt_t = std::nullopt)
95 std::nullopt_t
getValue()
const {
return std::nullopt; }
101template <
typename ValueTy>
116 return reinterpret_cast<const char *
>(
this + 1);
125 template <
typename AllocatorTy,
typename... InitTy>
127 InitTy &&...initVals) {
146 allocator.Deallocate(
static_cast<void *
>(
this), AllocSize,
152template <std::
size_t Index,
typename ValueTy>
154 static_assert(
Index < 2);
155 if constexpr (
Index == 0)
164template <
typename ValueTy>
165struct tuple_size<
llvm::StringMapEntry<ValueTy>>
166 : std::integral_constant<std::size_t, 2> {};
168template <std::
size_t I,
typename ValueTy>
169struct tuple_element<
I,
llvm::StringMapEntry<ValueTy>>
170 : std::conditional<I == 0, llvm::StringRef, ValueTy> {};
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringMapEntryBase - Shared base class of StringMapEntry instances.
size_t getKeyLength() const
static void * allocateWithKey(size_t EntrySize, size_t EntryAlign, StringRef Key, AllocatorTy &Allocator)
Helper to tail-allocate Key.
StringMapEntryBase(size_t keyLength)
StringMapEntryStorage(size_t keyLength, std::nullopt_t=std::nullopt)
StringMapEntryStorage(StringMapEntryStorage &entry)=delete
std::nullopt_t getValue() const
StringMapEntryStorage - Holds the value in a StringMapEntry.
StringMapEntryStorage(size_t keyLength)
StringMapEntryStorage(StringMapEntryStorage &e)=delete
StringMapEntryStorage(size_t keyLength, InitTy &&...initVals)
const ValueTy & getValue() const
void setValue(const ValueTy &V)
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
static StringMapEntry * create(StringRef key, AllocatorTy &allocator, InitTy &&...initVals)
Create a StringMapEntry for the specified key construct the value using InitiVals.
void Destroy(AllocatorTy &allocator)
Destroy - Destroy this StringMapEntry, releasing memory back to the specified allocator.
static StringMapEntry & GetStringMapEntryFromKeyData(const char *keyData)
GetStringMapEntryFromKeyData - Given key data that is known to be embedded into a StringMapEntry,...
const char * getKeyData() const
getKeyData - Return the start of the string data that is the key for this value.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Implement std::hash so that hash_code can be used in STL containers.