Skip to content

Commit 813f712

Browse files
committed
adjust declarations of DenseMapInfo for GCC
Remove the extra qualification and place explicitly in the LLVM namespace. This fixes some build issues with GCC 8.2.
1 parent ab2f4ce commit 813f712

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

include/swift/IDE/CodeCompletion.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,26 +899,28 @@ void copyCodeCompletionResults(CodeCompletionResultSink &targetSink,
899899
} // end namespace ide
900900
} // end namespace swift
901901

902-
template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionKeywordKind> {
902+
namespace llvm {
903+
template <> struct DenseMapInfo<swift::ide::CodeCompletionKeywordKind> {
903904
using Kind = swift::ide::CodeCompletionKeywordKind;
904905
static Kind getEmptyKey() { return Kind(~0u); }
905906
static Kind getTombstoneKey() { return Kind(~1u); }
906907
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
907908
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
908909
};
909-
template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionLiteralKind> {
910+
template <> struct DenseMapInfo<swift::ide::CodeCompletionLiteralKind> {
910911
using Kind = swift::ide::CodeCompletionLiteralKind;
911912
static Kind getEmptyKey() { return Kind(~0u); }
912913
static Kind getTombstoneKey() { return Kind(~1u); }
913914
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
914915
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
915916
};
916-
template <> struct llvm::DenseMapInfo<swift::ide::CodeCompletionDeclKind> {
917+
template <> struct DenseMapInfo<swift::ide::CodeCompletionDeclKind> {
917918
using Kind = swift::ide::CodeCompletionDeclKind;
918919
static Kind getEmptyKey() { return Kind(~0u); }
919920
static Kind getTombstoneKey() { return Kind(~1u); }
920921
static unsigned getHashValue(const Kind &Val) { return unsigned(Val); }
921922
static bool isEqual(const Kind &LHS, const Kind &RHS) { return LHS == RHS; }
922923
};
924+
}
923925

924926
#endif // SWIFT_IDE_CODECOMPLETION_H

include/swift/IRGen/Linking.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,8 @@ StringRef encodeForceLoadSymbolName(llvm::SmallVectorImpl<char> &buf,
994994
}
995995

996996
/// Allow LinkEntity to be used as a key for a DenseMap.
997-
template <> struct llvm::DenseMapInfo<swift::irgen::LinkEntity> {
997+
namespace llvm {
998+
template <> struct DenseMapInfo<swift::irgen::LinkEntity> {
998999
using LinkEntity = swift::irgen::LinkEntity;
9991000
static LinkEntity getEmptyKey() {
10001001
LinkEntity entity;
@@ -1020,4 +1021,5 @@ template <> struct llvm::DenseMapInfo<swift::irgen::LinkEntity> {
10201021
LHS.SecondaryPointer == RHS.SecondaryPointer && LHS.Data == RHS.Data;
10211022
}
10221023
};
1024+
}
10231025
#endif

include/swift/SILOptimizer/Analysis/AccessedStorageAnalysis.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ class StorageAccessInfo : public AccessedStorage {
9494
};
9595
} // namespace swift
9696

97+
namespace llvm {
9798
// Use the same DenseMapInfo for StorageAccessInfo as for AccessedStorage. None
9899
// of the subclass bitfields participate in the Key.
99-
template <> struct llvm::DenseMapInfo<swift::StorageAccessInfo> {
100+
template <> struct DenseMapInfo<swift::StorageAccessInfo> {
100101
static swift::StorageAccessInfo getEmptyKey() {
101102
auto key = DenseMapInfo<swift::AccessedStorage>::getEmptyKey();
102103
return static_cast<swift::StorageAccessInfo &>(key);
@@ -114,6 +115,7 @@ template <> struct llvm::DenseMapInfo<swift::StorageAccessInfo> {
114115
return DenseMapInfo<swift::AccessedStorage>::isEqual(LHS, RHS);
115116
}
116117
};
118+
}
117119

118120
namespace swift {
119121
/// The per-function result of AccessedStorageAnalysis.

include/swift/SILOptimizer/Analysis/AliasAnalysis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ bool isLetPointer(SILValue V);
306306
} // end namespace swift
307307

308308
namespace llvm {
309-
template <> struct llvm::DenseMapInfo<AliasKeyTy> {
309+
template <> struct DenseMapInfo<AliasKeyTy> {
310310
static inline AliasKeyTy getEmptyKey() {
311311
auto Allone = std::numeric_limits<size_t>::max();
312312
return {0, Allone, nullptr, nullptr};
@@ -331,7 +331,7 @@ namespace llvm {
331331
}
332332
};
333333

334-
template <> struct llvm::DenseMapInfo<MemBehaviorKeyTy> {
334+
template <> struct DenseMapInfo<MemBehaviorKeyTy> {
335335
static inline MemBehaviorKeyTy getEmptyKey() {
336336
auto Allone = std::numeric_limits<size_t>::max();
337337
return {0, Allone, RetainObserveKind::RetainObserveKindEnd};

include/swift/Syntax/SyntaxData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class SyntaxData final
294294
namespace llvm {
295295
using SD = swift::syntax::SyntaxData;
296296
using RCSD = swift::RC<SD>;
297-
template <> struct llvm::DenseMapInfo<RCSD> {
297+
template <> struct DenseMapInfo<RCSD> {
298298
static inline RCSD getEmptyKey() {
299299
return SD::make(nullptr, nullptr, 0);
300300
}

lib/IRGen/LocalTypeDataKind.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ class LocalTypeDataKey {
190190
}
191191
}
192192

193-
template <> struct llvm::DenseMapInfo<swift::irgen::LocalTypeDataKey> {
193+
namespace llvm {
194+
template <> struct DenseMapInfo<swift::irgen::LocalTypeDataKey> {
194195
using LocalTypeDataKey = swift::irgen::LocalTypeDataKey;
195196
using CanTypeInfo = DenseMapInfo<swift::CanType>;
196197
static inline LocalTypeDataKey getEmptyKey() {
@@ -209,5 +210,6 @@ template <> struct llvm::DenseMapInfo<swift::irgen::LocalTypeDataKey> {
209210
return a == b;
210211
}
211212
};
213+
}
212214

213215
#endif

0 commit comments

Comments
 (0)