================
@@ -8,27 +8,82 @@
 
 #include "lldb/Utility/RegisterType.h"
 
+#include "lldb/Utility/Stream.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/raw_ostream.h"
+
 #include <atomic>
+#include <cassert>
+#include <cinttypes>
+#include <limits>
 
 using namespace lldb_private;
 
-static std::atomic<uint64_t> g_next_register_type_uid{1};
+namespace {
+
+std::atomic<uint64_t> g_next_register_type_uid{1};
+
+void PrintXMLAttributeValue(Stream &strm, llvm::StringRef value) {
+  std::string escaped;
+  llvm::raw_string_ostream escape_strm(escaped);
+  llvm::printHTMLEscaped(value, escape_strm);
+  strm << escaped;
+}
+
+} // namespace
 
 RegisterType::RegisterType(RegisterTypeKind kind, std::string id)
     : m_kind(kind), m_id(std::move(id)),
       m_uid(g_next_register_type_uid.fetch_add(1, std::memory_order_relaxed)) 
{}
 
-void RegisterType::ToXML(
-    Stream &strm, std::unordered_set<const RegisterType *> &previously_emitted,
-    const RegisterType *user) const {
-  // If we already emitted this, don't emit it again.
-  if (!previously_emitted.insert(this).second)
+void RegisterType::ToXML(Stream &strm,
+                         std::unordered_set<std::string> &previously_emitted,
+                         const RegisterType *user) const {
+  if (getKind() == eRegisterTypeKindBuiltin)
+    return;
----------------
DavidSpickett wrote:

I would prefer that RegisterTypeBuiltin::ToXML and ToXMLElement were defined to 
do nothing. Rather than putting a type check here in the base class.

https://github.com/llvm/llvm-project/pull/217128
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to