File indexing completed on 2026-05-10 08:44:27
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_SUPPORT_BINARYSTREAMERROR_H
0010 #define LLVM_SUPPORT_BINARYSTREAMERROR_H
0011
0012 #include "llvm/ADT/StringRef.h"
0013 #include "llvm/Support/Error.h"
0014
0015 #include <string>
0016
0017 namespace llvm {
0018 enum class stream_error_code {
0019 unspecified,
0020 stream_too_short,
0021 invalid_array_size,
0022 invalid_offset,
0023 filesystem_error
0024 };
0025
0026
0027 class BinaryStreamError : public ErrorInfo<BinaryStreamError> {
0028 public:
0029 static char ID;
0030 explicit BinaryStreamError(stream_error_code C);
0031 explicit BinaryStreamError(StringRef Context);
0032 BinaryStreamError(stream_error_code C, StringRef Context);
0033
0034 void log(raw_ostream &OS) const override;
0035 std::error_code convertToErrorCode() const override;
0036
0037 StringRef getErrorMessage() const;
0038
0039 stream_error_code getErrorCode() const { return Code; }
0040
0041 private:
0042 std::string ErrMsg;
0043 stream_error_code Code;
0044 };
0045 }
0046
0047 #endif