Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- llvm/Support/Errc.h - Defines the llvm::errc enum --------*- 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 // While std::error_code works OK on all platforms we use, there are some
0010 // some problems with std::errc that can be avoided by using our own
0011 // enumeration:
0012 //
0013 // * std::errc is a namespace in some implementations. That means that ADL
0014 //   doesn't work and it is sometimes necessary to write std::make_error_code
0015 //   or in templates:
0016 //   using std::make_error_code;
0017 //   make_error_code(...);
0018 //
0019 //   with this enum it is safe to always just use make_error_code.
0020 //
0021 // * Some implementations define fewer names than others. This header has
0022 //   the intersection of all the ones we support.
0023 //
0024 // * std::errc is just marked with is_error_condition_enum. This means that
0025 //   common patterns like AnErrorCode == errc::no_such_file_or_directory take
0026 //   4 virtual calls instead of two comparisons.
0027 //===----------------------------------------------------------------------===//
0028 
0029 #ifndef LLVM_SUPPORT_ERRC_H
0030 #define LLVM_SUPPORT_ERRC_H
0031 
0032 #include <system_error>
0033 
0034 namespace llvm {
0035 enum class errc {
0036   argument_list_too_long = int(std::errc::argument_list_too_long),
0037   argument_out_of_domain = int(std::errc::argument_out_of_domain),
0038   bad_address = int(std::errc::bad_address),
0039   bad_file_descriptor = int(std::errc::bad_file_descriptor),
0040   broken_pipe = int(std::errc::broken_pipe),
0041   // There is no delete_pending in std::errc; this error code is negative to
0042   // avoid conflicts. This error roughly corresponds with Windows'
0043   // STATUS_DELETE_PENDING 0xC0000056.
0044   delete_pending = -56,
0045   device_or_resource_busy = int(std::errc::device_or_resource_busy),
0046   directory_not_empty = int(std::errc::directory_not_empty),
0047   executable_format_error = int(std::errc::executable_format_error),
0048   file_exists = int(std::errc::file_exists),
0049   file_too_large = int(std::errc::file_too_large),
0050   filename_too_long = int(std::errc::filename_too_long),
0051   function_not_supported = int(std::errc::function_not_supported),
0052   illegal_byte_sequence = int(std::errc::illegal_byte_sequence),
0053   inappropriate_io_control_operation =
0054       int(std::errc::inappropriate_io_control_operation),
0055   interrupted = int(std::errc::interrupted),
0056   invalid_argument = int(std::errc::invalid_argument),
0057   invalid_seek = int(std::errc::invalid_seek),
0058   io_error = int(std::errc::io_error),
0059   is_a_directory = int(std::errc::is_a_directory),
0060   no_child_process = int(std::errc::no_child_process),
0061   no_lock_available = int(std::errc::no_lock_available),
0062   no_space_on_device = int(std::errc::no_space_on_device),
0063   no_such_device_or_address = int(std::errc::no_such_device_or_address),
0064   no_such_device = int(std::errc::no_such_device),
0065   no_such_file_or_directory = int(std::errc::no_such_file_or_directory),
0066   no_such_process = int(std::errc::no_such_process),
0067   not_a_directory = int(std::errc::not_a_directory),
0068   not_enough_memory = int(std::errc::not_enough_memory),
0069   not_supported = int(std::errc::not_supported),
0070   operation_not_permitted = int(std::errc::operation_not_permitted),
0071   permission_denied = int(std::errc::permission_denied),
0072   read_only_file_system = int(std::errc::read_only_file_system),
0073   resource_deadlock_would_occur = int(std::errc::resource_deadlock_would_occur),
0074   resource_unavailable_try_again =
0075       int(std::errc::resource_unavailable_try_again),
0076   result_out_of_range = int(std::errc::result_out_of_range),
0077   too_many_files_open_in_system = int(std::errc::too_many_files_open_in_system),
0078   too_many_files_open = int(std::errc::too_many_files_open),
0079   too_many_links = int(std::errc::too_many_links)
0080 };
0081 
0082 inline std::error_code make_error_code(errc E) {
0083   return std::error_code(static_cast<int>(E), std::generic_category());
0084 }
0085 }
0086 
0087 namespace std {
0088 template <> struct is_error_code_enum<llvm::errc> : std::true_type {};
0089 }
0090 #endif