diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-01 01:37:34 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-01 01:37:34 +0000 |
commit | 7c23a18345a8fcf31ddd75e87e482bbd0f3306fe (patch) | |
tree | e50d02e623168e0eef213c05da34c28bf32b15d5 /lib/Serialization/MultiOnDiskHashTable.h | |
parent | d041cc813bcfcd04f077acdcea855f08b7d55577 (diff) | |
download | clang-7c23a18345a8fcf31ddd75e87e482bbd0f3306fe.tar.gz |
[modules] Preserve DeclID order when merging lookup tables to give a more
predictable diagnostic experience. The hash-of-DeclID order we were using
before gave different results on Win32 due to a different predefined
declaration of __builtin_va_list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/MultiOnDiskHashTable.h')
-rw-r--r-- | lib/Serialization/MultiOnDiskHashTable.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Serialization/MultiOnDiskHashTable.h b/lib/Serialization/MultiOnDiskHashTable.h index bf06a77912..704c6343a1 100644 --- a/lib/Serialization/MultiOnDiskHashTable.h +++ b/lib/Serialization/MultiOnDiskHashTable.h @@ -38,6 +38,7 @@ public: typedef typename Info::external_key_type external_key_type; typedef typename Info::internal_key_type internal_key_type; typedef typename Info::data_type data_type; + typedef typename Info::data_type_builder data_type_builder; typedef unsigned hash_value_type; private: @@ -135,8 +136,9 @@ private: // FIXME: Don't rely on the OnDiskHashTable format here. auto L = InfoObj.ReadKeyDataLength(LocalPtr); const internal_key_type &Key = InfoObj.ReadKey(LocalPtr, L.first); + data_type_builder ValueBuilder(Merged->Data[Key]); InfoObj.ReadDataInto(Key, LocalPtr + L.first, L.second, - Merged->Data[Key]); + ValueBuilder); } Merged->Files.push_back(ODT->File); @@ -218,12 +220,14 @@ public: Result = It->second; } + data_type_builder ResultBuilder(Result); + for (auto *ODT : tables()) { auto &HT = ODT->Table; auto It = HT.find_hashed(Key, KeyHash); if (It != HT.end()) HT.getInfoObj().ReadDataInto(Key, It.getDataPtr(), It.getDataLen(), - Result); + ResultBuilder); } return Result; @@ -233,13 +237,14 @@ public: /// sense if merging values across keys is meaningful. data_type findAll() { data_type Result; + data_type_builder ResultBuilder(Result); if (!PendingOverrides.empty()) removeOverriddenTables(); if (MergedTable *M = getMergedTable()) { for (auto &KV : M->Data) - Info::MergeDataInto(KV.second, Result); + Info::MergeDataInto(KV.second, ResultBuilder); } for (auto *ODT : tables()) { @@ -251,7 +256,7 @@ public: // FIXME: Don't rely on the OnDiskHashTable format here. auto L = InfoObj.ReadKeyDataLength(LocalPtr); const internal_key_type &Key = InfoObj.ReadKey(LocalPtr, L.first); - InfoObj.ReadDataInto(Key, LocalPtr + L.first, L.second, Result); + InfoObj.ReadDataInto(Key, LocalPtr + L.first, L.second, ResultBuilder); } } |