[llvm] 28b2bb8 - [AttrBuilder] Try to fix build

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 09:32:41 PDT 2021


Author: Nikita Popov
Date: 2021-07-09T18:27:57+02:00
New Revision: 28b2bb8f5486aa90123fa87827a284dd34957e64

URL: https://github.com/llvm/llvm-project/commit/28b2bb8f5486aa90123fa87827a284dd34957e64
DIFF: https://github.com/llvm/llvm-project/commit/28b2bb8f5486aa90123fa87827a284dd34957e64.diff

LOG: [AttrBuilder] Try to fix build

Some buildbots fail with undefined references to ByValTypeIndex
etc. Replace static consts with an enum to ensure the address is
not taken.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Attributes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index b96cade83345..4118fd556682 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -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;


        


More information about the llvm-commits mailing list