From: LLVM Packaging Team Date: Mon, 30 Dec 2019 14:31:05 +0000 (+0000) Subject: reproducible-pch X-Git-Tag: archive/raspbian/1%7.0.1-8+rpi3+deb10u2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0d6b7a3b544c96242872e89517b0588be42df258;p=llvm-toolchain-7.git reproducible-pch Author: Rebecca N. Palmer Bug-Debian: https://bugs.debian.org/877359 Forwarded: no Gbp-Pq: Name reproducible-pch.diff --- diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index f74269ee3..bfbc0b2f6 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4293,9 +4293,13 @@ void ASTWriter::WriteOpenCLExtensionTypes(Sema &SemaRef) { return; RecordData Record; + // Sort to allow reproducible .pch files - https://bugs.debian.org/877359 + std::map> sortedOpenCLTypeExtMap; for (const auto &I : SemaRef.OpenCLTypeExtMap) { - Record.push_back( - static_cast(getTypeID(I.first->getCanonicalTypeInternal()))); + sortedOpenCLTypeExtMap[getTypeID(I.first->getCanonicalTypeInternal())]=I.second; + } + for (const auto &I : sortedOpenCLTypeExtMap) { + Record.push_back(static_cast(I.first)); Record.push_back(I.second.size()); for (auto Ext : I.second) AddString(Ext, Record); @@ -4308,8 +4312,12 @@ void ASTWriter::WriteOpenCLExtensionDecls(Sema &SemaRef) { return; RecordData Record; + std::map> 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(I.second.size())); for (auto Ext : I.second) AddString(Ext, Record);