llvm.org GIT mirror llvm / a3dec00
[ADT] static_assert that SmallDenseMap is instantiated with a power-of-two number of inline buckets. Summary: If you try to instantiate it with a non-power-of-two buckets, DenseMap will assert at runtime (!) if we ever outgrow our inline storage. I believe using a constexpr function inside of a static_assert is safe now that we've unsupported MSVC 2013 and GCC < 4.8. Reviewers: bkramer, qcolombet, escha Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25900 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284985 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Lebar 3 years ago
1 changed file(s) with 2 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
741741 // simplicity of referring to them.
742742 typedef DenseMapBase BaseT;
743743 friend class DenseMapBase;
744 static_assert(isPowerOf2_64(InlineBuckets),
745 "InlineBuckets must be a power of 2.");
745747 unsigned Small : 1;
746748 unsigned NumEntries : 31;