summaryrefslogtreecommitdiff
path: root/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-01-29 22:40:22 +0000
committerReid Kleckner <rnk@google.com>2016-01-29 22:40:22 +0000
commit2e10304d4f8e2a9ef577674a8f441103bab6363f (patch)
treea40fe2c628772432295ba781017a43b32f5d4ac9 /lib/IR/AttributeImpl.h
parente98524387e5e649fbfae23e900074c83b5a6ee68 (diff)
Fix the MSVC build by moving static asserts into constructors
Apparently MSVC won't allow you to ask for the sizeof() a data member at class scope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/AttributeImpl.h')
-rw-r--r--lib/IR/AttributeImpl.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index 0cb60a49c65..374b90df1c9 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -152,11 +152,11 @@ class AttributeSetNode final
unsigned NumAttrs; ///< Number of attributes in this node.
/// Bitset with a bit for each available attribute Attribute::AttrKind.
uint64_t AvailableAttrs;
- static_assert(Attribute::EndAttrKinds <= sizeof(AvailableAttrs)*CHAR_BIT,
- "Too many attributes for AvailableAttrs");
AttributeSetNode(ArrayRef<Attribute> Attrs)
: NumAttrs(Attrs.size()), AvailableAttrs(0) {
+ static_assert(Attribute::EndAttrKinds <= sizeof(AvailableAttrs) * CHAR_BIT,
+ "Too many attributes for AvailableAttrs");
// There's memory after the node where we can store the entries in.
std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects<Attribute>());
@@ -218,9 +218,6 @@ private:
unsigned NumAttrs; ///< Number of entries in this set.
/// Bitset with a bit for each available attribute Attribute::AttrKind.
uint64_t AvailableFunctionAttrs;
- static_assert(Attribute::EndAttrKinds
- <= sizeof(AvailableFunctionAttrs)*CHAR_BIT,
- "Too many attributes");
// Helper fn for TrailingObjects class.
size_t numTrailingObjects(OverloadToken<IndexAttrPair>) { return NumAttrs; }
@@ -237,6 +234,9 @@ public:
AttributeSetImpl(LLVMContext &C,
ArrayRef<std::pair<unsigned, AttributeSetNode *> > Attrs)
: Context(C), NumAttrs(Attrs.size()), AvailableFunctionAttrs(0) {
+ static_assert(Attribute::EndAttrKinds <=
+ sizeof(AvailableFunctionAttrs) * CHAR_BIT,
+ "Too many attributes");
#ifndef NDEBUG
if (Attrs.size() >= 2) {