summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-03-20 23:33:18 +0000
committerZachary Turner <zturner@google.com>2017-03-20 23:33:18 +0000
commit82a0c97b32c2d581a239308a699f265f144e975b (patch)
tree0a10ad6e79b5e43a0ad7f44c0bdec40493d56aaf /clang/lib/Frontend/ASTUnit.cpp
parentba789cbd3da2fac7d46a39f8cef06d0ea51c5049 (diff)
downloadbcm5719-llvm-82a0c97b32c2d581a239308a699f265f144e975b.tar.gz
bcm5719-llvm-82a0c97b32c2d581a239308a699f265f144e975b.zip
Add a function to MD5 a file's contents.
In doing so, clean up the MD5 interface a little. Most existing users only care about the lower 8 bytes of an MD5, but for some users that care about the upper and lower, there wasn't a good interface. Furthermore, consumers of the MD5 checksum were required to handle endianness details on their own, so it seems reasonable to abstract this into a nicer interface that just gives you the right value. Differential Revision: https://reviews.llvm.org/D31105 llvm-svn: 298322
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 952992a9e8b..2acdc6494f8 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1252,7 +1252,7 @@ ASTUnit::PreambleFileHash::createForFile(off_t Size, time_t ModTime) {
PreambleFileHash Result;
Result.Size = Size;
Result.ModTime = ModTime;
- memset(Result.MD5, 0, sizeof(Result.MD5));
+ Result.MD5 = {};
return Result;
}
@@ -1273,7 +1273,7 @@ namespace clang {
bool operator==(const ASTUnit::PreambleFileHash &LHS,
const ASTUnit::PreambleFileHash &RHS) {
return LHS.Size == RHS.Size && LHS.ModTime == RHS.ModTime &&
- memcmp(LHS.MD5, RHS.MD5, sizeof(LHS.MD5)) == 0;
+ LHS.MD5 == RHS.MD5;
}
} // namespace clang
OpenPOWER on IntegriCloud