summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-03-27 00:47:43 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-03-27 00:47:43 +0000
commitacbbeb9782445a9f02b8f38c49b49aba2fb525b8 (patch)
tree777d9756bd5ad4d71fea62ee39175e33724ec37d /clang
parentbe3980b73c6c48832ed3ffc6760f0080e0217cbb (diff)
downloadbcm5719-llvm-acbbeb9782445a9f02b8f38c49b49aba2fb525b8.tar.gz
bcm5719-llvm-acbbeb9782445a9f02b8f38c49b49aba2fb525b8.zip
[Modules] Make our on-disk hash table of selector IDs be built in
a deterministic order. This uses a MapVector to track the insertion order of selectors. Found by inspection. llvm-svn: 233342
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Serialization/ASTWriter.h2
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp11
2 files changed, 6 insertions, 7 deletions
diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index bd01fc7df13..d7a801df369 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -276,7 +276,7 @@ private:
serialization::SelectorID NextSelectorID;
/// \brief Map that provides the ID numbers of each Selector.
- llvm::DenseMap<Selector, serialization::SelectorID> SelectorIDs;
+ llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
/// \brief Offset of each selector within the method pool/selector
/// table, indexed by the Selector ID (-1).
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 990a565e503..e5891abb56a 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -3029,13 +3029,12 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
// Create the on-disk hash table representation. We walk through every
// selector we've seen and look it up in the method pool.
SelectorOffsets.resize(NextSelectorID - FirstSelectorID);
- for (llvm::DenseMap<Selector, SelectorID>::iterator
- I = SelectorIDs.begin(), E = SelectorIDs.end();
- I != E; ++I) {
- Selector S = I->first;
+ for (auto &SelectorAndID : SelectorIDs) {
+ Selector S = SelectorAndID.first;
+ SelectorID ID = SelectorAndID.second;
Sema::GlobalMethodPool::iterator F = SemaRef.MethodPool.find(S);
ASTMethodPoolTrait::data_type Data = {
- I->second,
+ ID,
ObjCMethodList(),
ObjCMethodList()
};
@@ -3045,7 +3044,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
}
// Only write this selector if it's not in an existing AST or something
// changed.
- if (Chain && I->second < FirstSelectorID) {
+ if (Chain && ID < FirstSelectorID) {
// Selector already exists. Did it change?
bool changed = false;
for (ObjCMethodList *M = &Data.Instance;
OpenPOWER on IntegriCloud