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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 15:11:44 PDT 2024


================
@@ -116,18 +117,19 @@ template <typename T> class VectorNoCtor {
   uptr CapacityBytes = 0;
   uptr Size = 0;
 
-  T LocalData[256 / sizeof(T)] = {};
+  T LocalData[StaticCapacity] = {};
   MemMapT ExternalBuffer;
 };
 
-template <typename T> class Vector : public VectorNoCtor<T> {
+template <typename T, size_t StaticCapacity = 10>
+class Vector : public VectorNoCtor<T, Max<size_t>(10, StaticCapacity)> {
----------------
ChiaHungDuan wrote:

```suggestion
class Vector : public VectorNoCtor<T, StaticCapacity> {
```
It's a little bit weird to take `Max` here because the user will not be able to set the size smaller than 10 even when they think it's reasonable

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


More information about the llvm-commits mailing list