[libc] Trivial implementation of std::optional

This class has only the minimum functionality in it to provide what the
TZ variable parsing needs.  In particular, the standard makes guarantees
about how trivial the destructors are, throws an expception if it's used
incorrectly, etc.  There are also missing features.

Tested:
Trivial testsuite added, and use in development.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D129920

GitOrigin-RevId: 3b631e47fe4cfc366fd107c748e6ac01b4f5974a
4 files changed