Skip to content

Commit 48b866b

Browse files
committed
[NFC] Compare spiGroups in DenseMapInfo
This ought to result in more consistent behavior.
1 parent f719237 commit 48b866b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

include/swift/AST/Import.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,17 +691,20 @@ struct DenseMapInfo<swift::AttributedImport<ModuleInfo>> {
691691
using ModuleInfoDMI = DenseMapInfo<ModuleInfo>;
692692
using ImportOptionsDMI = DenseMapInfo<swift::ImportOptions>;
693693
using StringRefDMI = DenseMapInfo<StringRef>;
694-
// FIXME: SPI groups not used by DenseMapInfo???
694+
// We can't include spiGroups in the hash because ArrayRef<Identifier> is not
695+
// DenseMapInfo-able, but we do check that the spiGroups match in isEqual().
695696

696697
static inline AttributedImport getEmptyKey() {
697698
return AttributedImport(ModuleInfoDMI::getEmptyKey(),
698699
ImportOptionsDMI::getEmptyKey(),
699-
StringRefDMI::getEmptyKey());
700+
StringRefDMI::getEmptyKey(),
701+
{});
700702
}
701703
static inline AttributedImport getTombstoneKey() {
702704
return AttributedImport(ModuleInfoDMI::getTombstoneKey(),
703705
ImportOptionsDMI::getTombstoneKey(),
704-
StringRefDMI::getTombstoneKey());
706+
StringRefDMI::getTombstoneKey(),
707+
{});
705708
}
706709
static inline unsigned getHashValue(const AttributedImport &import) {
707710
return detail::combineHashValue(
@@ -714,7 +717,8 @@ struct DenseMapInfo<swift::AttributedImport<ModuleInfo>> {
714717
const AttributedImport &b) {
715718
return ModuleInfoDMI::isEqual(a.module, b.module) &&
716719
ImportOptionsDMI::isEqual(a.options, b.options) &&
717-
StringRefDMI::isEqual(a.sourceFileArg, b.sourceFileArg);
720+
StringRefDMI::isEqual(a.sourceFileArg, b.sourceFileArg) &&
721+
a.spiGroups == b.spiGroups;
718722
}
719723
};
720724
}

0 commit comments

Comments
 (0)