[llvm] 75aeb53 - SHA1.h - remove unnecessary ArrayRef.h/StringRef.h includes. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 21 07:12:34 PDT 2020
Author: Simon Pilgrim
Date: 2020-04-21T15:12:17+01:00
New Revision: 75aeb5348556f4d112e2a07a9a7a894ce2fb5180
URL: https://github.com/llvm/llvm-project/commit/75aeb5348556f4d112e2a07a9a7a894ce2fb5180
DIFF: https://github.com/llvm/llvm-project/commit/75aeb5348556f4d112e2a07a9a7a894ce2fb5180.diff
LOG: SHA1.h - remove unnecessary ArrayRef.h/StringRef.h includes. NFC.
By moving the update(StringRef) wrapper into SHA1.cpp we can depend just on system headers.
Added:
Modified:
llvm/include/llvm/Support/SHA1.h
llvm/lib/Support/SHA1.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/SHA1.h b/llvm/include/llvm/Support/SHA1.h
index 2cfbd2179364..efd8513cc201 100644
--- a/llvm/include/llvm/Support/SHA1.h
+++ b/llvm/include/llvm/Support/SHA1.h
@@ -15,14 +15,12 @@
#ifndef LLVM_SUPPORT_SHA1_H
#define LLVM_SUPPORT_SHA1_H
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringRef.h"
-
#include <array>
#include <cstdint>
namespace llvm {
template <typename T> class ArrayRef;
+class StringRef;
/// A class that wrap the SHA1 algorithm.
class SHA1 {
@@ -36,10 +34,7 @@ class SHA1 {
void update(ArrayRef<uint8_t> Data);
/// Digest more data.
- void update(StringRef Str) {
- update(ArrayRef<uint8_t>((uint8_t *)const_cast<char *>(Str.data()),
- Str.size()));
- }
+ void update(StringRef Str);
/// Return a reference to the current raw 160-bits SHA1 for the digested data
/// since the last call to init(). This call will add data to the internal
diff --git a/llvm/lib/Support/SHA1.cpp b/llvm/lib/Support/SHA1.cpp
index a98ca41a3354..417b13fea05a 100644
--- a/llvm/lib/Support/SHA1.cpp
+++ b/llvm/lib/Support/SHA1.cpp
@@ -16,13 +16,13 @@
#include "llvm/Support/SHA1.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Host.h"
-using namespace llvm;
-
-#include <stdint.h>
#include <string.h>
+using namespace llvm;
+
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
#define SHA_BIG_ENDIAN
#endif
@@ -238,6 +238,11 @@ void SHA1::update(ArrayRef<uint8_t> Data) {
addUncounted(C);
}
+void SHA1::update(StringRef Str) {
+ update(
+ ArrayRef<uint8_t>((uint8_t *)const_cast<char *>(Str.data()), Str.size()));
+}
+
void SHA1::pad() {
// Implement SHA-1 padding (fips180-2 5.1.1)
More information about the llvm-commits
mailing list