blob: b3f3930a1d585fc52eeee484d709422c91aedac2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
Description: Make ordering of OPENCL_EXTENSION_TYPES reproducible
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/877359
Forwarded: no
Index: llvm-toolchain-snapshot_8~svn349138/clang/lib/Serialization/ASTWriter.cpp
===================================================================
--- llvm-toolchain-snapshot_8~svn349138.orig/clang/lib/Serialization/ASTWriter.cpp
+++ llvm-toolchain-snapshot_8~svn349138/clang/lib/Serialization/ASTWriter.cpp
@@ -4279,9 +4279,13 @@ void ASTWriter::WriteOpenCLExtensionType
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 @@ void ASTWriter::WriteOpenCLExtensionDecl
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);
|