mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Remove StringMapEntryInitializer support.
It was never specialized so let's just remove that unused configurability and always do the default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -26,19 +26,6 @@ namespace llvm {
|
|||||||
template<typename ValueTy>
|
template<typename ValueTy>
|
||||||
class StringMapEntry;
|
class StringMapEntry;
|
||||||
|
|
||||||
/// StringMapEntryInitializer - This datatype can be partially specialized for
|
|
||||||
/// various datatypes in a stringmap to allow them to be initialized when an
|
|
||||||
/// entry is default constructed for the map.
|
|
||||||
template<typename ValueTy>
|
|
||||||
class StringMapEntryInitializer {
|
|
||||||
public:
|
|
||||||
template <typename InitTy>
|
|
||||||
static void Initialize(StringMapEntry<ValueTy> &T, InitTy InitVal) {
|
|
||||||
T.second = InitVal;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// StringMapEntryBase - Shared base class of StringMapEntry instances.
|
/// StringMapEntryBase - Shared base class of StringMapEntry instances.
|
||||||
class StringMapEntryBase {
|
class StringMapEntryBase {
|
||||||
unsigned StrLen;
|
unsigned StrLen;
|
||||||
@ -161,15 +148,12 @@ public:
|
|||||||
static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
|
static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
|
||||||
|
|
||||||
// Default construct the value.
|
// Default construct the value.
|
||||||
new (NewItem) StringMapEntry(KeyLength);
|
new (NewItem) StringMapEntry(KeyLength, InitVal);
|
||||||
|
|
||||||
// Copy the string information.
|
// Copy the string information.
|
||||||
char *StrBuffer = const_cast<char*>(NewItem->getKeyData());
|
char *StrBuffer = const_cast<char*>(NewItem->getKeyData());
|
||||||
memcpy(StrBuffer, KeyStart, KeyLength);
|
memcpy(StrBuffer, KeyStart, KeyLength);
|
||||||
StrBuffer[KeyLength] = 0; // Null terminate for convenience of clients.
|
StrBuffer[KeyLength] = 0; // Null terminate for convenience of clients.
|
||||||
|
|
||||||
// Initialize the value if the client wants to.
|
|
||||||
StringMapEntryInitializer<ValueTy>::Initialize(*NewItem, InitVal);
|
|
||||||
return NewItem;
|
return NewItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,23 +183,6 @@ TEST_F(StringMapTest, IterationTest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
namespace llvm {
|
|
||||||
|
|
||||||
template <>
|
|
||||||
class StringMapEntryInitializer<uint32_t> {
|
|
||||||
public:
|
|
||||||
template <typename InitTy>
|
|
||||||
static void Initialize(StringMapEntry<uint32_t> &T, InitTy InitVal) {
|
|
||||||
T.second = InitVal;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end llvm namespace
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// Test StringMapEntry::Create() method.
|
// Test StringMapEntry::Create() method.
|
||||||
TEST_F(StringMapTest, StringMapEntryTest) {
|
TEST_F(StringMapTest, StringMapEntryTest) {
|
||||||
StringMap<uint32_t>::value_type* entry =
|
StringMap<uint32_t>::value_type* entry =
|
||||||
|
Reference in New Issue
Block a user