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:
Daniel Dunbar
2009-07-23 18:17:34 +00:00
parent b53cc014d0
commit 6316fbcb04
12 changed files with 91 additions and 128 deletions

View File

@@ -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;
}