Deprecating llvm::Optional<X>::hasValue/getValue/getValueOr

I’m pretty sure all standard library vendors do assert that it contains a value (at least in debug builds), but I can’t disagree that relying on that behavior is a bad idea. Every access to optional must be guarded by a check that it contains a value.

I think this harms readability on several fronts (stretches vertically, breaks up expressions needlessly, and forces the reader to consider the possibility that the temporary variable has some other purpose later in the scope)

I disagree. The assert (that should contain a message) tells the reader that there is a contract, and not that someone forgot to add a check.

a Rust-like unwrap/expect, but implemented as a free-function.

Introducing an asserting wrapper may sound like a good idea. However, if you find yourself using it often, this probably indicates a problem with your code. Likely, you don’t need optional if you don’t check that it contains a value (i.e. if it is not really optional).