[Lldb-commits] [lldb] [lldb] Add Checksum class to lldbUtility (PR #71456)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 8 10:11:29 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());
----------------
JDevlieghere wrote:
`llvm::MD5::MD5Result` is just a wrapper around a `std::Array<uint8_t, 16>` so since the contents can't be moved, that wouldn't make a difference.
https://github.com/llvm/llvm-project/pull/71456
More information about the lldb-commits
mailing list