[Lldb-commits] [lldb] [lldb] Add register field enum class (PR #90063)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Fri May 3 02:03:11 PDT 2024


================
@@ -13,11 +13,42 @@
 #include <string>
 #include <vector>
 
+#include "llvm/ADT/StringSet.h"
+
 namespace lldb_private {
 
 class StreamString;
 class Log;
 
+class FieldEnum {
+public:
+  struct Enumerator {
+    uint64_t m_value;
+    // Short name for the value. Shown in tables and when printing the field's
+    // value. For example "RZ".
+    std::string m_name;
+
+    Enumerator(uint64_t value, std::string name)
+        : m_value(value), m_name(name) {}
+
+    void ToXML(StreamString &strm) const;
+  };
+
+  typedef std::vector<Enumerator> Enumerators;
+
+  FieldEnum(std::string id, const Enumerators &enumerators);
+
+  const Enumerators &GetEnumerators() const { return m_enumerators; }
+
+  const std::string &GetID() const { return m_id; }
+
+  void ToXML(StreamString &strm, unsigned size) const;
----------------
DavidSpickett wrote:

Just because the caller only uses StreamString, this can be Stream though no problem.

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


More information about the lldb-commits mailing list