[clang] [CIR] Upstream EHScopeStack memory allocator (PR #152215)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 7 00:05:10 PDT 2025
================
@@ -33,6 +34,54 @@ using namespace clang::CIRGen;
void EHScopeStack::Cleanup::anchor() {}
+/// Push an entry of the given size onto this protected-scope stack.
+char *EHScopeStack::allocate(size_t size) {
+ size = llvm::alignTo(size, ScopeStackAlignment);
+ if (!startOfBuffer) {
+ unsigned capacity = 1024;
+ while (capacity < size)
+ capacity *= 2;
----------------
xlauko wrote:
```suggestion
unsigned capacity = llvm::PowerOf2Ceil(std::max(size, 1024u));
```
https://github.com/llvm/llvm-project/pull/152215
More information about the cfe-commits
mailing list