[compiler-rt] Allow ZX_ERR_NO_RESOURCES with MAP_ALLOWNOMEM on Fuchsia (PR #89767)
Fabio D'Urso via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 06:04:21 PDT 2024
================
@@ -227,7 +234,7 @@ bool ReservedMemoryFuchsia::createImpl(UNUSED uptr Addr, uptr Size,
zx_status_t Status = _zx_vmar_map(_zx_vmar_root_self(), ZX_VM_ALLOW_FAULTS, 0,
getPlaceholderVmo(), 0, Size, &Base);
if (UNLIKELY(Status != ZX_OK)) {
- if (Status != ZX_ERR_NO_MEMORY || !AllowNoMem)
+ if (!IsNoMemError(Status) || !AllowNoMem)
----------------
fabio-d wrote:
I agree that it's a bit obscure in its current form. What about inverting the if condition like this?
```
if (AllowNoMem && IsNoMemError(Status)) {
... // cleanup actions, if any (in practice, only in mapImpl's second if)
return false;
}
dieOnError(Status, ...);
```
I can prepare a CL if you like this idea!
https://github.com/llvm/llvm-project/pull/89767
More information about the llvm-commits
mailing list