[AttrBuilder] Try to fix build
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 9 Jul 2021 16:27:57 +0000 (18:27 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 9 Jul 2021 16:27:57 +0000 (18:27 +0200)
Some buildbots fail with undefined references to ByValTypeIndex
etc. Replace static consts with an enum to ensure the address is
not taken.

llvm/include/llvm/IR/Attributes.h

index b96cade..4118fd5 100644 (file)
@@ -803,12 +803,14 @@ template <> struct DenseMapInfo<AttributeList> {
 /// equality, presence of attributes, etc.
 class AttrBuilder {
   // Indices into the TypeAttrs array.
-  static const unsigned ByValTypeIndex = 0;
-  static const unsigned StructRetTypeIndex = 1;
-  static const unsigned ByRefTypeIndex = 2;
-  static const unsigned PreallocatedTypeIndex = 3;
-  static const unsigned InAllocaTypeIndex = 4;
-  static const unsigned NumTypeIndices = 5;
+  enum : unsigned {
+    ByValTypeIndex = 0,
+    StructRetTypeIndex = 1,
+    ByRefTypeIndex = 2,
+    PreallocatedTypeIndex = 3,
+    InAllocaTypeIndex = 4,
+    NumTypeIndices = 5,
+  };
 
   std::bitset<Attribute::EndAttrKinds> Attrs;
   std::map<SmallString<32>, SmallString<32>, std::less<>> TargetDepAttrs;