Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:27

0001 //===- BinaryStreamError.h - Error extensions for Binary Streams *- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
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 /// Base class for errors originating when parsing raw PDB files
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 } // namespace llvm
0046 
0047 #endif // LLVM_SUPPORT_BINARYSTREAMERROR_H