[llvm-commits] [llvm] r171611 - in /llvm/trunk: include/llvm/IR/Attributes.h lib/IR/Attributes.cpp

NAKAMURA Takumi geek4civic at gmail.com
Fri Jan 4 23:55:47 PST 2013


Author: chapuni
Date: Sat Jan  5 01:55:47 2013
New Revision: 171611

URL: http://llvm.org/viewvc/llvm-project?rev=171611&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/IR/Attributes.h
    llvm/trunk/lib/IR/Attributes.cpp

Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=171611&r1=171610&r2=171611&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Sat Jan  5 01:55:47 2013
@@ -93,7 +93,11 @@
     UWTable,               ///< Function must be in a unwind table
     ZExt,                  ///< Zero extended before/after call
 
-    EndAttrKinds           ///< Sentinal value useful for loops
+    EndAttrKinds,          ///< Sentinal value useful for loops
+
+    // Values for DenseMapInfo
+    EmptyKey     = 0x7FFFFFFF,
+    TombstoneKey = -0x7FFFFFFF - 1
   };
 private:
   AttributeImpl *pImpl;
@@ -165,10 +169,10 @@
 /// AttrBuilder.
 template<> struct DenseMapInfo<Attribute::AttrKind> {
   static inline Attribute::AttrKind getEmptyKey() {
-    return Attribute::AttrKind(~0U);
+    return Attribute::EmptyKey;
   }
   static inline Attribute::AttrKind getTombstoneKey() {
-    return Attribute::AttrKind(~0U - 1);
+    return Attribute::TombstoneKey;
   }
   static unsigned getHashValue(const Attribute::AttrKind &Val) {
     return Val * 37U;

Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=171611&r1=171610&r2=171611&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Sat Jan  5 01:55:47 2013
@@ -426,6 +426,8 @@
 uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
   switch (Val) {
   case Attribute::EndAttrKinds:    break;
+  case Attribute::EmptyKey:        break;
+  case Attribute::TombstoneKey:    break;
   case Attribute::None:            return 0;
   case Attribute::ZExt:            return 1 << 0;
   case Attribute::SExt:            return 1 << 1;





More information about the llvm-commits mailing list