[Lldb-commits] [lldb] [lldb] Add Checksum class to lldbUtility (PR #71456)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 6 16:34:11 PST 2023


================
@@ -0,0 +1,46 @@
+//===-- Checksum.cpp ------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Utility/Checksum.h"
+#include "llvm/ADT/SmallString.h"
+
+using namespace lldb_private;
+
+Checksum::Checksum(llvm::MD5::MD5Result md5) { SetMD5(md5); }
+
+Checksum::Checksum(const Checksum &checksum) { SetMD5(checksum.m_checksum); }
+
+Checksum &Checksum::operator=(const Checksum &checksum) {
+  SetMD5(checksum.m_checksum);
+  return *this;
+}
+
+void Checksum::SetMD5(llvm::MD5::MD5Result md5) {
+  std::uninitialized_copy_n(md5.begin(), 16, m_checksum.begin());
----------------
bulbazord wrote:

Can you give a name to the 16? Or somehow turn it into a `sizeof` expression?

Also we're capturing the MD5Result by value, does it make sense to move it? 

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


More information about the lldb-commits mailing list