mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 14:46:07 +00:00

There are two aspects of non-determinism fixed here, which was the minimum required to cause at least an empty module to be deterministic. First, the random number signature is only inserted into the module when we are building modules implicitly. The use case for these random signatures is to work around the very fact that modules are not deterministic in their output when working with the implicitly built and populated module cache. Eventually this should go away entirely when we're confident that Clang is producing deterministic output. Second, the on-disk hash table is populated based on the order of iteration over a DenseMap. Instead, use a MapVector so that we can walk it in insertion order. I've added a test that an empty module, when built twice, produces the same binary PCM file. llvm-svn: 233115
16 lines
509 B
Plaintext
16 lines
509 B
Plaintext
// RUN: rm -rf %t
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
|
|
// RUN: -emit-module -fmodule-name=empty -o %t/base.pcm \
|
|
// RUN: %s
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
|
|
// RUN: -emit-module -fmodule-name=empty -o %t/check.pcm \
|
|
// RUN: %s
|
|
//
|
|
// RUN: diff %t/base.pcm %t/check.pcm
|
|
|
|
module empty { header "Inputs/empty.h" export * }
|