LLDB
mainline
llvm-project
lldb
source
Utility
Checksum.cpp
Go to the documentation of this file.
1
//===-- Checksum.cpp ------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
lldb/Utility/Checksum.h
"
10
#include "llvm/ADT/STLExtras.h"
11
#include "llvm/ADT/SmallString.h"
12
13
using namespace
lldb_private
;
14
15
Checksum::Checksum
(llvm::MD5::MD5Result md5) {
SetMD5
(md5); }
16
17
Checksum::Checksum
(
const
Checksum
&checksum) {
SetMD5
(checksum.
m_checksum
); }
18
19
Checksum
&
Checksum::operator=
(
const
Checksum
&checksum) {
20
SetMD5
(checksum.
m_checksum
);
21
return
*
this
;
22
}
23
24
void
Checksum::SetMD5
(llvm::MD5::MD5Result md5) {
25
const
constexpr
size_t
md5_length = 16;
26
std::uninitialized_copy_n(md5.begin(), md5_length,
m_checksum
.begin());
27
}
28
29
Checksum::operator bool()
const
{
return
!llvm::equal(m_checksum, g_sentinel); }
30
31
bool
Checksum::operator==
(
const
Checksum
&checksum)
const
{
32
return
llvm::equal(
m_checksum
, checksum.
m_checksum
);
33
}
34
35
bool
Checksum::operator!=
(
const
Checksum
&checksum)
const
{
36
return
!(*
this
== checksum);
37
}
38
39
std::string
Checksum::digest
()
const
{
40
return
std::string(
m_checksum
.digest());
41
}
42
43
llvm::MD5::MD5Result
Checksum::g_sentinel
= {
44
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
Checksum.h
lldb_private::Checksum
Definition:
Checksum.h:15
lldb_private::Checksum::operator=
Checksum & operator=(const Checksum &checksum)
Definition:
Checksum.cpp:19
lldb_private::Checksum::m_checksum
llvm::MD5::MD5Result m_checksum
Definition:
Checksum.h:32
lldb_private::Checksum::Checksum
Checksum(llvm::MD5::MD5Result md5=g_sentinel)
Definition:
Checksum.cpp:15
lldb_private::Checksum::g_sentinel
static llvm::MD5::MD5Result g_sentinel
Definition:
Checksum.h:17
lldb_private::Checksum::digest
std::string digest() const
Definition:
Checksum.cpp:39
lldb_private::Checksum::operator==
bool operator==(const Checksum &checksum) const
Definition:
Checksum.cpp:31
lldb_private::Checksum::SetMD5
void SetMD5(llvm::MD5::MD5Result)
Definition:
Checksum.cpp:24
lldb_private::Checksum::operator!=
bool operator!=(const Checksum &checksum) const
Definition:
Checksum.cpp:35
lldb_private
A class that represents a running process on the host machine.
Definition:
SBAddressRange.h:14
Generated on Fri Dec 20 2024 17:28:03 for LLDB by
1.9.6