This refactor is a pre-requisite to fixing rdar://problem/58789439. In
future patches we will modify this copy to pass a different environment
to atos. Due to working on a copy of the existing environment it is
expected that this patch will produce no functional change in most
cases.
The storage size for the copy of the environment is set statically so we
avoid doing a heap allocation at symbolization time where we might be
unable to allocate heap memory (e.g. when an out-of-memory situation has
been hit). Note that although AtosSymbolizerProcess is itself heap
allocated it is done so during early init where we should have enough
available heap memory.
In the case that the current process has more environment variables than
can be stored (currently 511 + 1 for null terminator) then a warning is
produced and the copy of the environment is truncated. A test case is
included for this scenario which should hopefully be rare.
clang-format-diff not found in user's PATH; not linting file.