The implementation of -fstack-arrays was added in https://reviews.llvm.org/D140415
I stored the option in CodeGenOpts because this seemed like the most relevant of what is available and creating a new options structure for a single boolean flag seemed like overkill.
-fstack-arrays is implied by -Ofast to match behavior by other fortran compilers.
The MemoryAllocationOpt pass is disabled when stack arrays is enabled because its purpose is the opposite: to move array allocations to the heap (although by default it won't move any allocations).
[nit] To me KeyPathAndMacro is just an implementation detail. The key part is that BoolOption does use the marshaling infra and BoolFlangOnlyOption does not. Perhaps rename as BoolOptionWithoutMarshalling? There isn't anything Flang specific here, is there?