[lldb] Change ObjectValueDictionary to use a StringMap
llvm has a structure for maps where the key's type is a string. Using that also means that the keys for OptionValueDictionary don't stick around forever in ConstString's StringPool (even after they are gone). The only thing we lose here is ordering: iterating over the map where the keys are ConstStrings guarantees that we iterate in alphabetical order. StringMap makes no guarantees about the ordering when you iterate over the entire map. Differential Revision: https://reviews.llvm.org/D149482
This commit is contained in:
@@ -300,20 +300,18 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
|
||||
if (!module_env_option) {
|
||||
// Step 2: Try with the file name in lowercase.
|
||||
auto name_lower = name.GetStringRef().lower();
|
||||
module_env_option =
|
||||
map->GetValueForKey(ConstString(llvm::StringRef(name_lower)));
|
||||
module_env_option = map->GetValueForKey(llvm::StringRef(name_lower));
|
||||
}
|
||||
if (!module_env_option) {
|
||||
// Step 3: Try with the file name with ".debug" suffix stripped.
|
||||
auto name_stripped = name.GetStringRef();
|
||||
if (name_stripped.consume_back_insensitive(".debug")) {
|
||||
module_env_option = map->GetValueForKey(ConstString(name_stripped));
|
||||
module_env_option = map->GetValueForKey(name_stripped);
|
||||
if (!module_env_option) {
|
||||
// Step 4: Try with the file name in lowercase with ".debug" suffix
|
||||
// stripped.
|
||||
auto name_lower = name_stripped.lower();
|
||||
module_env_option =
|
||||
map->GetValueForKey(ConstString(llvm::StringRef(name_lower)));
|
||||
module_env_option = map->GetValueForKey(llvm::StringRef(name_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user