diff options
author | Alexandre Rames <arames@apple.com> | 2021-09-03 11:12:27 -0700 |
---|---|---|
committer | Alexandre Rames <arames@apple.com> | 2021-09-03 11:13:36 -0700 |
commit | 655bea4226b401a11164f99c6344e38d8742b8e4 (patch) | |
tree | 07fbd0a7320c70d74612e9e3fbcb3a2a790f9430 /clang/unittests/Frontend/CompilerInvocationTest.cpp | |
parent | 830c0b9023cd0cf91955900e0d96283e7a8c3711 (diff) | |
download | llvm-655bea4226b401a11164f99c6344e38d8742b8e4.zip llvm-655bea4226b401a11164f99c6344e38d8742b8e4.tar.gz llvm-655bea4226b401a11164f99c6344e38d8742b8e4.tar.bz2 |
[modules] Use `HashBuilder` and `MD5` for the module hash.
Per the comments, `hash_code` values "are not stable to save or
persist", so are unsuitable for the module hash, which must persist
across compilations for the implicit module hashes to match. Note that
in practice, today, `hash_code` are stable. But this is an
implementation detail, with a clear `FIXME` indicating we should switch
to a per-execution seed.
The stability of `MD5` also allows modules cross-compilation use-cases.
The `size_t` underlying storage for `hash_code` varying across platforms
could cause mismatching hashes when cross-compiling from a 64bit
target to a 32bit target.
Note that native endianness is still used for the hash computation. So hashes
will differ between platforms of different endianness.
Reviewed By: jansvoboda11
Differential Revision: https://reviews.llvm.org/D102943
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
-rw-r--r-- | clang/unittests/Frontend/CompilerInvocationTest.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 9bcbf1f..692d04a 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -860,9 +860,7 @@ struct DummyModuleFileExtension return {}; }; - llvm::hash_code hashExtension(llvm::hash_code Code) const override { - return {}; - } + void hashExtension(ExtensionHashBuilder &HBuilder) const override {} std::unique_ptr<ModuleFileExtensionWriter> createExtensionWriter(ASTWriter &Writer) override { |