[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)

Adrian Vogelsgesang via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 1 23:52:16 PDT 2024


================
@@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key);
 ///     strings, numbers or booleans.
 std::vector<std::string> GetStrings(const llvm::json::Object *obj,
                                     llvm::StringRef key);
+/// Extract an object of key value strings for the specified key from an object.
+///
+/// String values in the array will be extracted without any quotes
+/// around them. Numbers and Booleans will be converted into
+/// strings. Any NULL, array or objects values in the array will be
+/// ignored.
+///
+/// \param[in] obj
+///     A JSON object that we will attempt to extract the array from
+///
+/// \param[in] key
+///     The key to use when extracting the value
+///
+/// \return
+///     An object of key value strings for the specified \a key, or
+///     \a fail_value if there is no key that matches or if the
+///     value is not an object or key and values in the object are not
+///     strings, numbers or booleans.
+std::unordered_map<std::string, std::string>
+GetStringObject(const llvm::json::Object &obj, llvm::StringRef key);
----------------
vogelsgesang wrote:

Feels slightly more self-explanatory to me:

```suggestion
GetStringMap(const llvm::json::Object &obj, llvm::StringRef key);
```

https://github.com/llvm/llvm-project/pull/106919


More information about the lldb-commits mailing list