summaryrefslogtreecommitdiff
path: root/lldb/include
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-04-28 13:23:55 -0700
committerAlex Langford <alangford@apple.com>2023-05-01 16:17:24 -0700
commite53e1de57eccda49a93c4368eabbd95d01c5b854 (patch)
treee5e22891fbc76a1ed10d0024575228a31f24c1c5 /lldb/include
parent2a333e9104c855596f64ceb9d7d72a31856ad769 (diff)
downloadllvm-e53e1de57eccda49a93c4368eabbd95d01c5b854.tar.gz
[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
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueDictionary.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h
index 1fdccdeccef5..4c250468b3cd 100644
--- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h
+++ b/lldb/include/lldb/Interpreter/OptionValueDictionary.h
@@ -9,11 +9,11 @@
#ifndef LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
#define LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
-#include <map>
-
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/lldb-private-types.h"
+#include "llvm/ADT/StringMap.h"
+
namespace lldb_private {
class OptionValueDictionary
@@ -58,7 +58,7 @@ public:
size_t GetNumValues() const { return m_values.size(); }
- lldb::OptionValueSP GetValueForKey(ConstString key) const;
+ lldb::OptionValueSP GetValueForKey(llvm::StringRef key) const;
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name, bool will_modify,
@@ -67,21 +67,19 @@ public:
Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
llvm::StringRef name, llvm::StringRef value) override;
- bool SetValueForKey(ConstString key,
- const lldb::OptionValueSP &value_sp,
+ bool SetValueForKey(llvm::StringRef key, const lldb::OptionValueSP &value_sp,
bool can_replace = true);
- bool DeleteValueForKey(ConstString key);
+ bool DeleteValueForKey(llvm::StringRef key);
size_t GetArgs(Args &args) const;
Status SetArgs(const Args &args, VarSetOperationType op);
protected:
- typedef std::map<ConstString, lldb::OptionValueSP> collection;
uint32_t m_type_mask;
OptionEnumValues m_enum_values;
- collection m_values;
+ llvm::StringMap<lldb::OptionValueSP> m_values;
bool m_raw_value_dump;
};