FileManager::getFileRef is a modern API which we expect to convert to
over time. We should modernize the error handling as well, using
llvm::Expected instead of llvm::ErrorOr, to help clients that care
about errors to ensure nothing is missed.
However, not all clients care. I've also added another path for those
that don't:
- FileEntryRef is now copy- and move-assignable (using a pointer instead of a reference).
- FileManager::getOptionalFileRef returns an llvm::Optional instead of llvm::Expected.
- Added an llvm::expectedToOptional utility in case this is useful elsewhere.
It should be fine to update the return type, but I believe that Expected will cause an assertion as the error is unhandled in cases like this one. Can you verify that all errors are consumed somehow?