This PR adds `CommandLine.executablePath`. We have use cases for this property
in Swift Testing, Swift Argument Parser, Foundation, and other places; three use
cases a stdlib API makes.
Need to consider how best to handle back-deployment on Apple platforms. It
should be possible to support back-deployment since the underlying crt_extern
function has been present for decades, however calling it may prove non-trivial.
I haven't made an attempt at it yet.
Pending Swift Evolution review. We can mark this `@_spi` or underscored in the
mean time.
This is for the 'freestanding' build to stop assuming the platform has argc/argv.
- Introduce a new sub-library, libswiftCommandLineSupport.a
- Move stubs/CommandLine.cpp into this library
- Conditionally embed it into libswiftCore
- Conditionally embed it into libswiftPrivateLibcExtras if not in libswiftCore to support testing
- Add SWIFT_STDLIB_HAS_COMMANDLINE CMake (and build-script) flag
* Removing FIXME from methods also marked always/never
* Unavailable/deprecated things don't need inlining
* Trivial implementations
* Enum namespaces
* Unsafe performance of opaque/raw pointer
* Dump doesn't need to be fast
* Error paths shouldn't require inlining
* Consistency with surrounding code
* Lazy performance needs specialization
In theory there could be a "fixed-layout" enum that's not exhaustive
but promises not to add any more cases with payloads, but we don't
need that distinction today.
(Note that @objc enums are still "fixed-layout" in the actual sense of
"having a compile-time known layout". There's just no special way to
spell that.)