Skip to content

adjust declarations of DenseMapInfo for GCC #19996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions include/swift/IDE/CodeCompletion.h
Original file line number Diff line number Diff line change
Expand Up @@ -899,26 +899,28 @@ void copyCodeCompletionResults(CodeCompletionResultSink &targetSink,
} // end namespace ide
} // end namespace swift

template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionKeywordKind> {
namespace llvm {
template <> struct DenseMapInfo<swift::ide::CodeCompletionKeywordKind> {
using Kind = swift::ide::CodeCompletionKeywordKind;
static Kind getEmptyKey() { return Kind(~0u); }
static Kind getTombstoneKey() { return Kind(~1u); }
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
};
template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionLiteralKind> {
template <> struct DenseMapInfo<swift::ide::CodeCompletionLiteralKind> {
using Kind = swift::ide::CodeCompletionLiteralKind;
static Kind getEmptyKey() { return Kind(~0u); }
static Kind getTombstoneKey() { return Kind(~1u); }
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
};
template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionDeclKind> {
template <> struct DenseMapInfo<swift::ide::CodeCompletionDeclKind> {
using Kind = swift::ide::CodeCompletionDeclKind;
static Kind getEmptyKey() { return Kind(~0u); }
static Kind getTombstoneKey() { return Kind(~1u); }
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
};
}

#endif // SWIFT_IDE_CODECOMPLETION_H
4 changes: 3 additions & 1 deletion include/swift/IRGen/Linking.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,8 @@ StringRef encodeForceLoadSymbolName(llvm::SmallVectorImpl<char> &buf,
}

/// Allow LinkEntity to be used as a key for a DenseMap.
template <> struct llvm::DenseMapInfo<swift::irgen::LinkEntity> {
namespace llvm {
template <> struct DenseMapInfo<swift::irgen::LinkEntity> {
using LinkEntity = swift::irgen::LinkEntity;
static LinkEntity getEmptyKey() {
LinkEntity entity;
Expand All @@ -1020,4 +1021,5 @@ template <> struct llvm::DenseMapInfo<swift::irgen::LinkEntity> {
LHS.SecondaryPointer == RHS.SecondaryPointer && LHS.Data == RHS.Data;
}
};
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ class StorageAccessInfo : public AccessedStorage {
};
} // namespace swift

namespace llvm {
// Use the same DenseMapInfo for StorageAccessInfo as for AccessedStorage. None
// of the subclass bitfields participate in the Key.
template <> struct llvm::DenseMapInfo<swift::StorageAccessInfo> {
template <> struct DenseMapInfo<swift::StorageAccessInfo> {
static swift::StorageAccessInfo getEmptyKey() {
auto key = DenseMapInfo<swift::AccessedStorage>::getEmptyKey();
return static_cast<swift::StorageAccessInfo &>(key);
Expand All @@ -114,6 +115,7 @@ template <> struct llvm::DenseMapInfo<swift::StorageAccessInfo> {
return DenseMapInfo<swift::AccessedStorage>::isEqual(LHS, RHS);
}
};
}

namespace swift {
/// The per-function result of AccessedStorageAnalysis.
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SILOptimizer/Analysis/AliasAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ bool isLetPointer(SILValue V);
} // end namespace swift

namespace llvm {
template <> struct llvm::DenseMapInfo<AliasKeyTy> {
template <> struct DenseMapInfo<AliasKeyTy> {
static inline AliasKeyTy getEmptyKey() {
auto Allone = std::numeric_limits<size_t>::max();
return {0, Allone, nullptr, nullptr};
Expand All @@ -331,7 +331,7 @@ namespace llvm {
}
};

template <> struct llvm::DenseMapInfo<MemBehaviorKeyTy> {
template <> struct DenseMapInfo<MemBehaviorKeyTy> {
static inline MemBehaviorKeyTy getEmptyKey() {
auto Allone = std::numeric_limits<size_t>::max();
return {0, Allone, RetainObserveKind::RetainObserveKindEnd};
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Syntax/SyntaxData.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class SyntaxData final
namespace llvm {
using SD = swift::syntax::SyntaxData;
using RCSD = swift::RC<SD>;
template <> struct llvm::DenseMapInfo<RCSD> {
template <> struct DenseMapInfo<RCSD> {
static inline RCSD getEmptyKey() {
return SD::make(nullptr, nullptr, 0);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/IRGen/LocalTypeDataKind.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ class LocalTypeDataKey {
}
}

template <> struct llvm::DenseMapInfo<swift::irgen::LocalTypeDataKey> {
namespace llvm {
template <> struct DenseMapInfo<swift::irgen::LocalTypeDataKey> {
using LocalTypeDataKey = swift::irgen::LocalTypeDataKey;
using CanTypeInfo = DenseMapInfo<swift::CanType>;
static inline LocalTypeDataKey getEmptyKey() {
Expand All @@ -209,5 +210,6 @@ template <> struct llvm::DenseMapInfo<swift::irgen::LocalTypeDataKey> {
return a == b;
}
};
}

#endif