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);
123 template <
typename AllocatorTy,
typename... InitTy>
125 InitTy &&...initVals) {
144 allocator.Deallocate(
static_cast<void *
>(
this), AllocSize,
151template <std::
size_t Index,
typename ValueTy>
153 static_assert(
Index < 2);
154 if constexpr (
Index == 0)
160template <std::
size_t Index,
typename ValueTy>
162 static_assert(
Index < 2);
163 if constexpr (
Index == 0)
171template <
typename ValueTy>
172struct std::tuple_size<
llvm::StringMapEntry<ValueTy>>
173 : std::integral_constant<std::size_t, 2> {};
175template <std::
size_t Index,
typename ValueTy>
176struct std::tuple_element<
Index,
llvm::StringMapEntry<ValueTy>>
177 : std::tuple_element<Index, std::pair<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.