[PATCH] D60379: Make precompiled headers reproducible
Sylvestre Ledru via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 7 15:09:37 PDT 2019
sylvestre.ledru created this revision.
sylvestre.ledru added reviewers: yaxunl, Anastasia.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This patch have been applied to Debian packages for a few months without
any regression.
Patch by Rebecca N. Palmer
Repository:
rC Clang
https://reviews.llvm.org/D60379
Files:
lib/Serialization/ASTWriter.cpp
Index: lib/Serialization/ASTWriter.cpp
===================================================================
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -4279,9 +4279,13 @@
return;
RecordData Record;
+ // Sort to allow reproducible .pch files - https://bugs.debian.org/877359
+ std::map<TypeID, std::set<std::string>> sortedOpenCLTypeExtMap;
for (const auto &I : SemaRef.OpenCLTypeExtMap) {
- Record.push_back(
- static_cast<unsigned>(getTypeID(I.first->getCanonicalTypeInternal())));
+ sortedOpenCLTypeExtMap[getTypeID(I.first->getCanonicalTypeInternal())]=I.second;
+ }
+ for (const auto &I : sortedOpenCLTypeExtMap) {
+ Record.push_back(static_cast<unsigned>(I.first));
Record.push_back(I.second.size());
for (auto Ext : I.second)
AddString(Ext, Record);
@@ -4294,8 +4298,12 @@
return;
RecordData Record;
+ std::map<DeclID, std::set<std::string>> sortedOpenCLDeclExtMap;
for (const auto &I : SemaRef.OpenCLDeclExtMap) {
- Record.push_back(getDeclID(I.first));
+ sortedOpenCLDeclExtMap[getDeclID(I.first)]=I.second;
+ }
+ for (const auto &I : sortedOpenCLDeclExtMap) {
+ Record.push_back(I.first);
Record.push_back(static_cast<unsigned>(I.second.size()));
for (auto Ext : I.second)
AddString(Ext, Record);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60379.194074.patch
Type: text/x-patch
Size: 1329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190407/e3c5d198/attachment.bin>
More information about the cfe-commits
mailing list