File indexing completed on 2026-05-10 08:44:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef LLVM_SUPPORT_MSVCERRORWORKAROUNDS_H
0019 #define LLVM_SUPPORT_MSVCERRORWORKAROUNDS_H
0020
0021 #include "llvm/Support/Error.h"
0022
0023 namespace llvm {
0024
0025
0026
0027 class MSVCPError : public Error {
0028 public:
0029 MSVCPError() { (void)!!*this; }
0030
0031 MSVCPError(MSVCPError &&Other) : Error(std::move(Other)) {}
0032
0033 MSVCPError &operator=(MSVCPError Other) {
0034 Error::operator=(std::move(Other));
0035 return *this;
0036 }
0037
0038 MSVCPError(Error Err) : Error(std::move(Err)) {}
0039 };
0040
0041
0042
0043 template <typename T> class MSVCPExpected : public Expected<T> {
0044 public:
0045 MSVCPExpected()
0046 : Expected<T>(make_error<StringError>("", inconvertibleErrorCode())) {
0047 consumeError(this->takeError());
0048 }
0049
0050 MSVCPExpected(MSVCPExpected &&Other) : Expected<T>(std::move(Other)) {}
0051
0052 MSVCPExpected &operator=(MSVCPExpected &&Other) {
0053 Expected<T>::operator=(std::move(Other));
0054 return *this;
0055 }
0056
0057 MSVCPExpected(Error Err) : Expected<T>(std::move(Err)) {}
0058
0059 template <typename OtherT>
0060 MSVCPExpected(
0061 OtherT &&Val,
0062 std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
0063 : Expected<T>(std::move(Val)) {}
0064
0065 template <class OtherT>
0066 MSVCPExpected(
0067 Expected<OtherT> &&Other,
0068 std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
0069 : Expected<T>(std::move(Other)) {}
0070
0071 template <class OtherT>
0072 explicit MSVCPExpected(
0073 Expected<OtherT> &&Other,
0074 std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr)
0075 : Expected<T>(std::move(Other)) {}
0076 };
0077
0078 }
0079
0080 #endif