[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
This commit is contained in:
Chandler Carruth 2015-03-27 00:47:43 +00:00
parent be3980b73c
commit acbbeb9782
2 changed files with 6 additions and 7 deletions

View File

@ -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).

View File

@ -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;