mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-01 01:26:56 +00:00
Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications! - I kept StringMap::GetOrCreateValue for compatibility purposes, this can eventually go away. Likewise the StringMapEntry Create functions still follow the old style. - NIFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -75,20 +75,17 @@ GCModuleInfo::~GCModuleInfo() {
|
||||
|
||||
GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,
|
||||
const std::string &Name) {
|
||||
const char *Start = Name.c_str();
|
||||
|
||||
strategy_map_type::iterator NMI =
|
||||
StrategyMap.find(Start, Start + Name.size());
|
||||
strategy_map_type::iterator NMI = StrategyMap.find(Name);
|
||||
if (NMI != StrategyMap.end())
|
||||
return NMI->getValue();
|
||||
|
||||
for (GCRegistry::iterator I = GCRegistry::begin(),
|
||||
E = GCRegistry::end(); I != E; ++I) {
|
||||
if (strcmp(Start, I->getName()) == 0) {
|
||||
if (Name == I->getName()) {
|
||||
GCStrategy *S = I->instantiate();
|
||||
S->M = M;
|
||||
S->Name = Name;
|
||||
StrategyMap.GetOrCreateValue(Start, Start + Name.size()).setValue(S);
|
||||
StrategyMap.GetOrCreateValue(Name).setValue(S);
|
||||
StrategyList.push_back(S);
|
||||
return S;
|
||||
}
|
||||
|
Reference in New Issue
Block a user