This patch have been applied to Debian packages for a few months without
any regression.
https://bugs.debian.org/877359
Patch by Rebecca N. Palmer
Differential D60379
Make precompiled headers reproducible sylvestre.ledru on Apr 7 2019, 3:07 PM. Authored by
Details This patch have been applied to Debian packages for a few months without https://bugs.debian.org/877359 Patch by Rebecca N. Palmer
Diff Detail
Event TimelineComment Actions Needs a test.
Comment Actions I won't have time to write the test for that (and would not know where to start). I am just the messenger :)
Comment Actions After looking at the bug report (https://bugs.debian.org/877359), I would like to point out that there is currently *absolutely* no stability guarantee for the serialization format (ie, you need the exact same revision). In regard of this I am wondering how sane it is to ship pch files. Comment Actions I agree we shouldn't make guarantees about pch file format stability and that distributing pch files isn't a good idea. Having said that, making clang write the same output when given the same input is still a Good Thing as it enables caching these outputs e.g. with tools like distcc. Comment Actions To be clear, this isn't about format stability and distributing but making sure that two same runs of clang produces the same output. Comment Actions Good point. I went through each of the structures serialized in ASTWriter.cpp, and unless I missed one, OpenCLDeclExtMap and OpenCLTypeExtMap are the only one which are serialized in a non-deterministic way (so my earlier inline comment was mistaken).
Comment Actions FYI, I switched to std::map in this review: @sylvestre.ledru do you think it's possible to apply this patch and see if it work for your bug? Btw I am still confused about the reproducibility - does clang produce the same PCH at least for the runs on the same revision? |
Would it be better to just change the actual type of SemaRef.OpenCLTypeExtMap?
https://github.com/llvm-mirror/clang/blob/18917301298ad6df9e989983ed1e22cb0f9dff29/include/clang/Sema/Sema.h#L8710-L8712