Skip to content

Commit 646e9ac

Browse files
committed
SR-11889: Fixed code review issues
1 parent a2cce2b commit 646e9ac

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

include/swift/Basic/Located.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,33 @@ struct Located {
5454

5555
} // end namespace swift
5656

57+
namespace llvm {
58+
59+
template <typename T> struct DenseMapInfo;
60+
61+
template<typename T>
62+
struct DenseMapInfo<swift::Located<T>> {
63+
64+
static inline swift::Located<T> getEmptyKey() {
65+
return swift::Located<T>(DenseMapInfo<T>::getEmptyKey(),
66+
DenseMapInfo<swift::SourceLoc>::getEmptyKey());
67+
}
68+
69+
static inline swift::Located<T> getTombstoneKey() {
70+
return swift::Located<T>(DenseMapInfo<T>::getTombstoneKey(),
71+
DenseMapInfo<swift::SourceLoc>::getTombstoneKey());
72+
}
73+
74+
static unsigned getHashValue(const swift::Located<T> &LocatedVal) {
75+
return combineHashValue(DenseMapInfo<T>::getHashValue(LocatedVal.Item),
76+
DenseMapInfo<swift::SourceLoc>::getHashValue(LocatedVal.Loc));
77+
}
78+
79+
static bool isEqual(const swift::Located<T> &LHS, const swift::Located<T> &RHS) {
80+
return DenseMapInfo<T>::isEqual(LHS.Item, RHS.Item) &&
81+
DenseMapInfo<T>::isEqual(LHS.Loc, RHS.Loc);
82+
}
83+
};
84+
} // namespace llvm
85+
5786
#endif // SWIFT_BASIC_LOCATED_H

lib/ClangImporter/ImporterImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
631631
public:
632632
/// Load a module using either method.
633633
ModuleDecl *loadModule(SourceLoc importLoc,
634-
ArrayRef<std::pair<Identifier, SourceLoc>> path);
634+
ArrayRef<Located<Identifier>> path);
635635

636636
void recordImplicitUnwrapForDecl(ValueDecl *decl, bool isIUO) {
637637
if (!isIUO)

0 commit comments

Comments
 (0)