LLVM  14.0.0git
BinaryStreamError.h
Go to the documentation of this file.
1 //===- BinaryStreamError.h - Error extensions for Binary Streams *- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_SUPPORT_BINARYSTREAMERROR_H
10 #define LLVM_SUPPORT_BINARYSTREAMERROR_H
11 
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/Support/Error.h"
14 
15 #include <string>
16 
17 namespace llvm {
18 enum class stream_error_code {
24 };
25 
26 /// Base class for errors originating when parsing raw PDB files
27 class BinaryStreamError : public ErrorInfo<BinaryStreamError> {
28 public:
29  static char ID;
33 
34  void log(raw_ostream &OS) const override;
35  std::error_code convertToErrorCode() const override;
36 
37  StringRef getErrorMessage() const;
38 
39  stream_error_code getErrorCode() const { return Code; }
40 
41 private:
42  std::string ErrMsg;
43  stream_error_code Code;
44 };
45 } // namespace llvm
46 
47 #endif // LLVM_SUPPORT_BINARYSTREAMERROR_H
llvm::BinaryStreamError::BinaryStreamError
BinaryStreamError(stream_error_code C)
Definition: BinaryStreamError.cpp:16
llvm::BinaryStreamError::getErrorMessage
StringRef getErrorMessage() const
Definition: BinaryStreamError.cpp:51
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
StringRef.h
llvm::stream_error_code::unspecified
@ unspecified
Error.h
llvm::BinaryStreamError::convertToErrorCode
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition: BinaryStreamError.cpp:53
llvm::BinaryStreamError::getErrorCode
stream_error_code getErrorCode() const
Definition: BinaryStreamError.h:39
llvm::BinaryStreamError::log
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Definition: BinaryStreamError.cpp:49
llvm::stream_error_code::invalid_offset
@ invalid_offset
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::BinaryStreamError::ID
static char ID
Definition: BinaryStreamError.h:29
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::stream_error_code
stream_error_code
Definition: BinaryStreamError.h:18
llvm::ErrorInfo
Base class for user error types.
Definition: Error.h:349
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::BinaryStreamError
Base class for errors originating when parsing raw PDB files.
Definition: BinaryStreamError.h:27
llvm::stream_error_code::stream_too_short
@ stream_too_short
llvm::stream_error_code::filesystem_error
@ filesystem_error
llvm::stream_error_code::invalid_array_size
@ invalid_array_size