[compiler-rt] [scudo] Add static vector functionality. (PR #98986)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 14:15:23 PDT 2024


================
@@ -116,18 +116,20 @@ template <typename T> class VectorNoCtor {
   uptr CapacityBytes = 0;
   uptr Size = 0;
 
-  T LocalData[256 / sizeof(T)] = {};
+  T LocalData[StaticNumEntries] = {};
   MemMapT ExternalBuffer;
 };
 
-template <typename T> class Vector : public VectorNoCtor<T> {
+template <typename T, size_t StaticNumEntries>
+class Vector : public VectorNoCtor<T, StaticNumEntries> {
 public:
-  constexpr Vector() { VectorNoCtor<T>::init(); }
+  static_assert(StaticNumEntries > 0U, "");
----------------
cferris1000 wrote:

It would be good to have a error message here. Something like:

"Does not support no static entries."

Or something like it.

https://github.com/llvm/llvm-project/pull/98986


More information about the llvm-commits mailing list