1//===- Error.h - system_error extensions for Object -------------*- C++ -*-===//
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
7//===----------------------------------------------------------------------===//
9// This declares a new error_category for the Object library.
11//===----------------------------------------------------------------------===//
13#ifndef LLVM_OBJECT_ERROR_H
14#define LLVM_OBJECT_ERROR_H
18#include <system_error>
29 // Error code 0 is absent. Use std::error_code() instead.
45/// Base class for all errors indicating malformed binary files.
47/// Having a subclass for all malformed binary files allows archive-walking
48/// code to skip malformed files without having to understand every possible
49/// way that a binary file might be malformed.
51/// Currently inherits from ECError for easy interoperability with
52/// std::error_code, but this will be removed in the future.
54 void anchor()
override;
58 // Default to parse_failed, can be overridden with setErrorCode.
63/// Generic binary error.
65/// For errors that don't require their own specific sub-error (most errors)
66/// this class can be used to describe the error via a string message.
68 :
public ErrorInfo<GenericBinaryError, BinaryError> {
79/// isNotObjectErrorInvalidFileType() is used when looping through the children
80/// of an archive after calling getAsBinary() on the child and it returns an
81/// llvm::Error. In the cases we want to loop through the children and ignore the
82/// non-objects in the archive this is used to test the error to see if an
83/// error() function needs to called on the llvm::Error.
90}
// end namespace object.
92}
// end namespace llvm.
96 struct is_error_code_enum<
llvm::object::object_error> : std::true_type {};
void setErrorCode(std::error_code EC)
Base class for user error types.
Lightweight error class with error context and mandatory checking.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
GenericBinaryError(const Twine &Msg)
const std::string & getMessage() const
This class implements an extremely fast bulk output stream that can only output to a stream.
Error createError(const Twine &Err)
std::error_code make_error_code(object_error e)
@ string_table_non_null_end
@ bitcode_section_not_found
LLVM_ABI const std::error_category & object_category()
LLVM_ABI Error isNotObjectErrorInvalidFileType(llvm::Error Err)
isNotObjectErrorInvalidFileType() is used when looping through the children of an archive after calli...
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Implement std::hash so that hash_code can be used in STL containers.