Skip to content

Commit 3a4779a

Browse files
committed
IR/Attributes: Provide EmptyKey and TombstoneKey in part of enum, as workaround for gcc-4.4 take #2.
I will investigate, later, what was wrong. I am too tired for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171611 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 00ece1b commit 3a4779a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/llvm/IR/Attributes.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ class Attribute {
9393
UWTable, ///< Function must be in a unwind table
9494
ZExt, ///< Zero extended before/after call
9595

96-
EndAttrKinds ///< Sentinal value useful for loops
96+
EndAttrKinds, ///< Sentinal value useful for loops
97+
98+
// Values for DenseMapInfo
99+
EmptyKey = 0x7FFFFFFF,
100+
TombstoneKey = -0x7FFFFFFF - 1
97101
};
98102
private:
99103
AttributeImpl *pImpl;
@@ -165,10 +169,10 @@ class Attribute {
165169
/// AttrBuilder.
166170
template<> struct DenseMapInfo<Attribute::AttrKind> {
167171
static inline Attribute::AttrKind getEmptyKey() {
168-
return Attribute::AttrKind(~0U);
172+
return Attribute::EmptyKey;
169173
}
170174
static inline Attribute::AttrKind getTombstoneKey() {
171-
return Attribute::AttrKind(~0U - 1);
175+
return Attribute::TombstoneKey;
172176
}
173177
static unsigned getHashValue(const Attribute::AttrKind &Val) {
174178
return Val * 37U;

lib/IR/Attributes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ uint64_t AttributeImpl::getBitMask() const {
426426
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
427427
switch (Val) {
428428
case Attribute::EndAttrKinds: break;
429+
case Attribute::EmptyKey: break;
430+
case Attribute::TombstoneKey: break;
429431
case Attribute::None: return 0;
430432
case Attribute::ZExt: return 1 << 0;
431433
case Attribute::SExt: return 1 << 1;

0 commit comments

Comments
 (0)