WPILibC++  2020.3.2-60-g3011ebe
wpi Namespace Reference

WPILib C++ utilities (wpiutil) namespace. More...

Namespaces

 detail
 detail namespace with internal helper functions
 
 java
 Java Native Interface (JNI) utility functions.
 

Classes

struct  add_const_past_pointer
 If T is a pointer to X, return a pointer to const X. More...
 
struct  add_const_past_pointer< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 
struct  add_lvalue_reference_if_not_pointer
 If T is a pointer, just return it. If it is not, return T&. More...
 
struct  add_lvalue_reference_if_not_pointer< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 
struct  adl_serializer
 default JSONSerializer template argument More...
 
struct  AlignedCharArray
 
struct  AlignedCharArrayUnion
 This union template exposes a suitably aligned and sized character array member which can hold elements of any of up to ten types. More...
 
struct  AlignTo
 alignTo for contexts where a constant expression is required. More...
 
struct  are_base_of
 traits class for checking whether type T is a base class for all the given types in the variadic list. More...
 
struct  are_base_of< T, U, Ts... >
 
class  ArrayRef
 ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. More...
 
class  buffer_ostream
 
class  circular_buffer
 This is a simple circular buffer so we don't need to "bucket brigade" copy old values. More...
 
class  concat_iterator
 Iterator wrapper that concatenates sequences together. More...
 
class  ConcurrentQueue
 
struct  const_pointer_or_const_ref
 
struct  const_pointer_or_const_ref< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 
class  DebugEpochBase
 A base class for data structure classes wishing to make iterators ("handles") pointing into themselves fail-fast. More...
 
class  DenseMap
 
class  DenseMapBase
 
struct  DenseMapInfo
 
struct  DenseMapInfo< ArrayRef< T > >
 
struct  DenseMapInfo< char >
 
struct  DenseMapInfo< hash_code >
 
struct  DenseMapInfo< int >
 
struct  DenseMapInfo< long >
 
struct  DenseMapInfo< long long >
 
struct  DenseMapInfo< PointerIntPair< PointerTy, IntBits, IntType > >
 
struct  DenseMapInfo< PointerUnion< T, U > >
 
struct  DenseMapInfo< short >
 
struct  DenseMapInfo< std::pair< T, U > >
 
struct  DenseMapInfo< StringRef >
 
struct  DenseMapInfo< T * >
 
struct  DenseMapInfo< unsigned >
 
struct  DenseMapInfo< unsigned long >
 
struct  DenseMapInfo< unsigned long long >
 
struct  DenseMapInfo< unsigned short >
 
class  DenseMapIterator
 
struct  deref
 Binary functor that adapts to any other binary functor after dereferencing operands. More...
 
class  ECError
 This class wraps a std::error_code in a Error. More...
 
class  Error
 Lightweight error class with error context and mandatory checking. More...
 
class  ErrorAsOutParameter
 Helper for Errors used as out-parameters. More...
 
class  ErrorHandlerTraits
 Helper for testing applicability of, and applying, handlers for ErrorInfo types. More...
 
class  ErrorHandlerTraits< Error(&)(ErrT &)>
 
class  ErrorHandlerTraits< Error(&)(std::unique_ptr< ErrT >)>
 Specialization for functions of the form 'Error (std::unique_ptr<ErrT>)'. More...
 
class  ErrorHandlerTraits< RetT(C::*)(const ErrT &) const >
 
class  ErrorHandlerTraits< RetT(C::*)(const ErrT &)>
 
class  ErrorHandlerTraits< RetT(C::*)(ErrT &) const >
 
class  ErrorHandlerTraits< RetT(C::*)(ErrT &)>
 
class  ErrorHandlerTraits< RetT(C::*)(std::unique_ptr< ErrT >) const >
 Specialization for member functions of the form 'RetT (std::unique_ptr<ErrT>) const'. More...
 
class  ErrorHandlerTraits< RetT(C::*)(std::unique_ptr< ErrT >)>
 Specialization for member functions of the form 'RetT (std::unique_ptr<ErrT>)'. More...
 
class  ErrorHandlerTraits< void(&)(ErrT &)>
 
class  ErrorHandlerTraits< void(&)(std::unique_ptr< ErrT >)>
 Specialization for functions of the form 'void (std::unique_ptr<ErrT>)'. More...
 
class  ErrorInfo
 Base class for user error types. More...
 
class  ErrorInfoBase
 Base class for error info classes. More...
 
class  ErrorList
 Special ErrorInfo subclass representing a list of ErrorInfos. More...
 
class  ErrorOr
 Represents either an error or a value T. More...
 
class  ErrorSuccess
 Subclass of Error for the sole purpose of identifying the success path in the type system. More...
 
class  EventLoopRunner
 Executes an event loop on a separate thread. More...
 
class  ExitOnError
 Helper for check-and-exit error handling. More...
 
class  Expected
 Tagged union holding either a T or a Error. More...
 
class  ExpectedAsOutParameter
 Helper for Expected<T>s used as out-parameters. More...
 
class  FileError
 This class wraps a filename and another Error. More...
 
class  filter_iterator_base
 An iterator adaptor that filters the elements of given inner iterators. More...
 
class  filter_iterator_impl
 Specialization of filter_iterator_base for forward iteration only. More...
 
class  filter_iterator_impl< WrappedIteratorT, PredicateT, std::bidirectional_iterator_tag >
 Specialization of filter_iterator_base for bidirectional iteration. More...
 
class  format_object
 
class  format_object_base
 This is a helper class used for handling formatted output. More...
 
class  FormattedBytes
 
class  FormattedNumber
 This is a helper class used for format_hex() and format_decimal(). More...
 
class  FormattedString
 This is a helper class for left_justify, right_justify, and center_justify. More...
 
struct  FreeDeleter
 
class  function_ref
 An efficient, type-erasing, non-owning reference to a callable. More...
 
class  function_ref< Ret(Params...)>
 
struct  FunctionPointerLikeTypeTraits
 Provide suitable custom traits struct for function pointers. More...
 
class  future
 A lightweight version of std::future. More...
 
class  future< void >
 Explicit specialization for future<void>. More...
 
struct  greater_ptr
 
struct  has_rbegin
 Metafunction to determine if T& or T has a member called rbegin(). More...
 
class  has_rbegin_impl
 Helper to determine if type T has a member called rbegin(). More...
 
class  hash_code
 An opaque object representing a hash code. More...
 
struct  http_parser
 
struct  http_parser_settings
 
struct  http_parser_url
 
class  HttpConnection
 
class  HttpLocation
 
class  HttpMultipartScanner
 
class  HttpParser
 HTTP protocol parser. More...
 
class  HttpRequest
 
class  HttpServerConnection
 
struct  identity
 
class  IntrusiveRefCntPtr
 A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCountedBase. More...
 
struct  IntrusiveRefCntPtrInfo
 Class you can specialize to provide custom retain/release functionality for a type. More...
 
class  is_integral_or_enum
 Metafunction that determines whether the given type is either an integral type or an enumeration type, including enum classes. More...
 
struct  is_one_of
 traits class for checking whether type T is one of any of the given types in the variadic list. More...
 
struct  is_one_of< T, U, Ts... >
 
struct  isPodLike
 isPodLike - This is a type trait that is used to determine whether a given type can be copied around with memcpy instead of running ctors etc. More...
 
struct  isPodLike< ArrayRef< T > >
 
struct  isPodLike< PointerIntPair< PointerTy, IntBits, IntType > >
 
struct  isPodLike< std::pair< T, U > >
 
struct  isPodLike< StringRef >
 
class  iterator_adaptor_base
 CRTP base class for adapting an iterator to a different type. More...
 
class  iterator_facade_base
 CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of the interface. More...
 
class  iterator_range
 A range adaptor for a pair of iterators. More...
 
class  json
 a class to store JSON values More...
 
class  json_pointer
 
struct  less_first
 Function object to check whether the first component of a std::pair compares less than the first component of another std::pair. More...
 
struct  less_ptr
 
struct  less_second
 Function object to check whether the second component of a std::pair compares less than the second component of another std::pair. More...
 
class  Logger
 
struct  make_const_ptr
 
struct  make_const_ref
 
class  ManagedStatic
 ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on demand (good for reducing startup times of dynamic libraries that link in LLVM components) and for making destruction be explicit through the wpi_shutdown() function call. More...
 
class  ManagedStaticBase
 ManagedStaticBase - Common base class for ManagedStatic instances. More...
 
class  mapped_iterator
 
class  MapVector
 This class implements a map that also provides access to all stored values in a deterministic order. More...
 
class  MutableArrayRef
 MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memory), i.e. More...
 
class  NetworkAcceptor
 
class  NetworkStream
 
struct  object_creator
 object_creator - Helper method for ManagedStatic. More...
 
struct  object_deleter
 object_deleter - Helper method for ManagedStatic. More...
 
struct  object_deleter< T[N]>
 
struct  on_first
 Function object to apply a binary function to the first component of a std::pair. More...
 
class  OwningArrayRef
 This is a MutableArrayRef that owns its array. More...
 
struct  pair_hash
 
struct  pointee_iterator
 An iterator type that allows iterating over the pointees via some other iterator. More...
 
class  pointer_iterator
 
class  PointerIntPair
 PointerIntPair - This class implements a pair of a pointer and small integer. More...
 
struct  PointerIntPairInfo
 
struct  PointerLikeTypeTraits
 A traits type that is used to handle pointer types and things that are just wrappers for pointers as a uniform entity. More...
 
struct  PointerLikeTypeTraits< const T * >
 
struct  PointerLikeTypeTraits< const T >
 
struct  PointerLikeTypeTraits< PointerIntPair< PointerTy, IntBits, IntType, PtrTraits > >
 
struct  PointerLikeTypeTraits< PointerUnion3< PT1, PT2, PT3 > >
 
struct  PointerLikeTypeTraits< PointerUnion4< PT1, PT2, PT3, PT4 > >
 
struct  PointerLikeTypeTraits< PointerUnion< PT1, PT2 > >
 
struct  PointerLikeTypeTraits< ReturnT(*)(ParamTs...)>
 Provide a default specialization for function pointers that assumes 4-byte alignment. More...
 
struct  PointerLikeTypeTraits< T * >
 
struct  PointerLikeTypeTraits< uintptr_t >
 
struct  PointerLikeTypeTraits< void * >
 
class  PointerUnion
 A discriminated union of two pointer types, with the discriminator in the low bit of the pointer. More...
 
class  PointerUnion3
 A pointer union of three pointer types. More...
 
class  PointerUnion4
 A pointer union of four pointer types. More...
 
struct  PointerUnionTypeSelector
 Get a type based on whether two types are the same or not. More...
 
struct  PointerUnionTypeSelector< T, T, RET_EQ, RET_NE >
 
struct  PointerUnionTypeSelectorReturn
 
struct  PointerUnionTypeSelectorReturn< PointerUnionTypeSelector< T1, T2, RET_EQ, RET_NE > >
 
class  PointerUnionUIntTraits
 Provide PointerLikeTypeTraits for void* that is used by PointerUnion for the two template arguments. More...
 
class  PortForwarder
 Forward ports to another host. More...
 
class  PriorityQueue
 This class adds a method for removing all elements from the priority queue matching the given value. More...
 
class  promise
 A lightweight version of std::promise. More...
 
class  promise< void >
 Explicit specialization for promise<void>. More...
 
class  PromiseFactory
 A promise factory for lightweight futures. More...
 
class  PromiseFactory< void >
 Explicit specialization for PromiseFactory<void>. More...
 
struct  rank
 Utility type to build an inheritance chain that makes it easy to rank overload candidates. More...
 
struct  rank< 0 >
 
class  raw_fd_istream
 
class  raw_fd_ostream
 A raw_ostream that writes to a file descriptor. More...
 
class  raw_istream
 
class  raw_mem_istream
 
class  raw_null_ostream
 A raw_ostream that discards all output. More...
 
class  raw_os_ostream
 raw_os_ostream - A raw_ostream that writes to an std::ostream. More...
 
class  raw_ostream
 This class implements an extremely fast bulk output stream that can only output to a stream. More...
 
class  raw_pwrite_stream
 An abstract base class for streams implementations that also support a pwrite operation. More...
 
class  raw_socket_istream
 
class  raw_socket_ostream
 
class  raw_string_ostream
 A raw_ostream that writes to an std::string. More...
 
class  raw_svector_ostream
 A raw_ostream that writes to an SmallVector or SmallString. More...
 
class  raw_usvector_ostream
 A raw_ostream that writes to an SmallVector or SmallString. More...
 
class  raw_uv_ostream
 raw_ostream style output to a SmallVector of uv::Buffer buffers. More...
 
class  raw_uvector_ostream
 A raw_ostream that writes to a vector. More...
 
class  raw_vector_ostream
 A raw_ostream that writes to a vector. More...
 
class  recursive_spinlock1
 A recursive spinlock mutex. More...
 
class  recursive_spinlock2
 A recursive spinlock mutex. More...
 
class  RefCountedBase
 A CRTP mixin class that adds reference counting to a type. More...
 
struct  RoundUpToPowerOfTwo
 RoundUpToPowerOfTwo - This is a helper template that rounds N up to the next power of two (which means N itself if N is already a power of two). More...
 
struct  RoundUpToPowerOfTwoH
 RoundUpToPowerOfTwoH - If N is not a power of two, increase it. More...
 
struct  RoundUpToPowerOfTwoH< N, false >
 
class  SafeThread
 
class  SafeThreadOwner
 
struct  SameType
 
struct  ScopedFatalErrorHandler
 ScopedFatalErrorHandler - This is a simple helper class which just calls install_fatal_error_handler in its constructor and remove_fatal_error_handler in its destructor. More...
 
class  SHA1
 
struct  simplify_type
 
struct  simplify_type< const IntrusiveRefCntPtr< T > >
 
struct  simplify_type< IntrusiveRefCntPtr< T > >
 
class  SmallDenseMap
 
struct  SmallMapVector
 A MapVector that performs no allocations if smaller than a certain size. More...
 
class  SmallPtrSet
 SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements. More...
 
class  SmallPtrSetImpl
 A templated base class for SmallPtrSet which provides the typesafe interface that is common across all small sizes. More...
 
class  SmallPtrSetImplBase
 SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s, which is almost everything. More...
 
class  SmallPtrSetIterator
 SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet. More...
 
class  SmallPtrSetIteratorImpl
 SmallPtrSetIteratorImpl - This is the common base class shared between all instances of SmallPtrSetIterator. More...
 
class  SmallSet
 SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less than N). More...
 
class  SmallSet< PointeeType *, N >
 If this set is of pointer values, transparently switch over to using SmallPtrSet for performance. More...
 
class  SmallSetIterator
 SmallSetIterator - This class implements a const_iterator for SmallSet by delegating to the underlying SmallVector or Set iterators. More...
 
class  SmallString
 SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better as a string (e.g. More...
 
class  SmallVector
 This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small. More...
 
struct  SmallVectorAlignmentAndSize
 Figure out the offset of the first element. More...
 
class  SmallVectorBase
 This is all the non-templated stuff common to all SmallVectors. More...
 
class  SmallVectorImpl
 This class consists of common code factored out of the SmallVector class to reduce code duplication based on the SmallVector 'N' template parameter. More...
 
struct  SmallVectorStorage
 Storage for the SmallVector elements. More...
 
struct  SmallVectorStorage< T, 0 >
 We need the storage to be properly aligned even for small-size of 0 so that the pointer math in SmallVectorTemplateCommon::getFirstEl() is well-defined. More...
 
class  SmallVectorTemplateBase
 SmallVectorTemplateBase<isPodLike = false> - This is where we put method implementations that are designed to work with non-POD-like T's. More...
 
class  SmallVectorTemplateBase< T, true >
 SmallVectorTemplateBase<isPodLike = true> - This is where we put method implementations that are designed to work with POD-like T's. More...
 
class  SmallVectorTemplateCommon
 This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD. More...
 
class  spinlock
 A spinlock mutex. More...
 
class  StringError
 This class wraps a string in an Error. More...
 
class  StringLiteral
 A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs with the length computed at compile time. More...
 
class  StringMap
 StringMap - This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. More...
 
class  StringMapConstIterator
 
class  StringMapEntry
 StringMapEntry - This is used to represent one value that is inserted into a StringMap. More...
 
class  StringMapEntryBase
 StringMapEntryBase - Shared base class of StringMapEntry instances. More...
 
class  StringMapImpl
 StringMapImpl - This is the base class of StringMap that is shared among all of its instantiations. More...
 
class  StringMapIterator
 
class  StringMapIterBase
 
class  StringMapKeyIterator
 
class  StringRef
 StringRef - Represent a constant reference to a string, i.e. More...
 
class  TCPAcceptor
 
class  TCPConnector
 
class  TCPStream
 
class  ThreadSafeRefCountedBase
 A thread-safe version of RefCountedBase. More...
 
class  Twine
 Twine - A lightweight data structure for efficiently representing the concatenation of temporary values as strings. More...
 
class  UDPClient
 
class  UidVector
 
class  unique_function
 
class  unique_function< ReturnT(ParamTs...)>
 
class  UrlParser
 Parses a URL into its constiuent components. More...
 
struct  validate_format_parameters
 These are templated helper classes used by the format function that capture the object to be formatted and the format string. More...
 
struct  validate_format_parameters< Arg, Args... >
 
struct  validate_format_parameters<>
 
class  VersionTuple
 Represents a version number in the form major[.minor[.subminor[.build]]]. More...
 
class  WebSocket
 RFC 6455 compliant WebSocket client and server implementation. More...
 
class  WebSocketServer
 Dedicated WebSocket server. More...
 
class  WebSocketServerHelper
 WebSocket HTTP server helper. More...
 
class  WorkerThread
 
class  WorkerThread< R(T...)>
 
struct  wpi_shutdown_obj
 wpi_shutdown_obj - This is a simple helper class that calls wpi_shutdown() when it is destroyed. More...
 

Typedefs

typedef void(* fatal_error_handler_t) (void *user_data, const std::string &reason, bool gen_crash_diag)
 An error handler callback.
 
using condition_variable = ::std::condition_variable
 
typedef unsigned int UTF32
 
typedef unsigned short UTF16
 
typedef unsigned char UTF8
 
typedef bool Boolean
 
using recursive_spinlock = recursive_spinlock1
 
template<typename T >
using optional = std::optional< T >
 
using nullopt_t = std::nullopt_t
 
using mutex = ::std::mutex
 
using recursive_mutex = ::std::recursive_mutex
 
template<typename WrappedIteratorT , typename PredicateT >
using filter_iterator = filter_iterator_impl< WrappedIteratorT, PredicateT, typename detail::fwd_or_bidi_tag< WrappedIteratorT >::type >
 Defines filter_iterator to a suitable specialization of filter_iterator_impl, based on the underlying iterator's category.
 
typedef int(* http_data_cb) (http_parser *, const char *at, size_t length)
 
typedef int(* http_cb) (http_parser *)
 

Enumerations

enum  ConversionResult { conversionOK, sourceExhausted, targetExhausted, sourceIllegal }
 
enum  ConversionFlags { strictConversion = 0, lenientConversion }
 
enum  ZeroBehavior { ZB_Undefined, ZB_Max, ZB_Width }
 The behavior an operation has on an input of 0. More...
 
enum  LogLevel {
  WPI_LOG_CRITICAL = 50, WPI_LOG_ERROR = 40, WPI_LOG_WARNING = 30, WPI_LOG_INFO = 20,
  WPI_LOG_DEBUG = 10, WPI_LOG_DEBUG1 = 9, WPI_LOG_DEBUG2 = 8, WPI_LOG_DEBUG3 = 7,
  WPI_LOG_DEBUG4 = 6
}
 
enum  errc {
  argument_list_too_long = int(std::errc::argument_list_too_long), argument_out_of_domain = int(std::errc::argument_out_of_domain), bad_address = int(std::errc::bad_address), bad_file_descriptor = int(std::errc::bad_file_descriptor),
  broken_pipe = int(std::errc::broken_pipe), device_or_resource_busy = int(std::errc::device_or_resource_busy), directory_not_empty = int(std::errc::directory_not_empty), executable_format_error = int(std::errc::executable_format_error),
  file_exists = int(std::errc::file_exists), file_too_large = int(std::errc::file_too_large), filename_too_long = int(std::errc::filename_too_long), function_not_supported = int(std::errc::function_not_supported),
  illegal_byte_sequence = int(std::errc::illegal_byte_sequence), inappropriate_io_control_operation, interrupted = int(std::errc::interrupted), invalid_argument = int(std::errc::invalid_argument),
  invalid_seek = int(std::errc::invalid_seek), io_error = int(std::errc::io_error), is_a_directory = int(std::errc::is_a_directory), no_child_process = int(std::errc::no_child_process),
  no_lock_available = int(std::errc::no_lock_available), no_space_on_device = int(std::errc::no_space_on_device), no_such_device_or_address = int(std::errc::no_such_device_or_address), no_such_device = int(std::errc::no_such_device),
  no_such_file_or_directory = int(std::errc::no_such_file_or_directory), no_such_process = int(std::errc::no_such_process), not_a_directory = int(std::errc::not_a_directory), not_enough_memory = int(std::errc::not_enough_memory),
  not_supported = int(std::errc::not_supported), operation_not_permitted = int(std::errc::operation_not_permitted), permission_denied = int(std::errc::permission_denied), read_only_file_system = int(std::errc::read_only_file_system),
  resource_deadlock_would_occur = int(std::errc::resource_deadlock_would_occur), resource_unavailable_try_again, result_out_of_range = int(std::errc::result_out_of_range), too_many_files_open_in_system = int(std::errc::too_many_files_open_in_system),
  too_many_files_open = int(std::errc::too_many_files_open), too_many_links = int(std::errc::too_many_links)
}
 
enum  FloatStyle { Exponent, ExponentUpper, Fixed, Percent }
 
enum  IntegerStyle { Integer, Number }
 
enum  HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower }
 
enum  http_status
 
enum  http_method
 
enum  http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }
 
enum  flags {
  F_CHUNKED = 1 << 0, F_CONNECTION_KEEP_ALIVE = 1 << 1, F_CONNECTION_CLOSE = 1 << 2, F_CONNECTION_UPGRADE = 1 << 3,
  F_TRAILING = 1 << 4, F_UPGRADE = 1 << 5, F_SKIPBODY = 1 << 6, F_CONTENTLENGTH = 1 << 7
}
 
enum  http_errno
 
enum  http_parser_url_fields {
  UF_SCHEMA = 0, UF_HOST = 1, UF_PORT = 2, UF_PATH = 3,
  UF_QUERY = 4, UF_FRAGMENT = 5, UF_USERINFO = 6, UF_MAX = 7
}
 

Functions

LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc (size_t Sz)
 
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_calloc (size_t Count, size_t Sz)
 
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_realloc (void *Ptr, size_t Sz)
 
void install_fatal_error_handler (fatal_error_handler_t handler, void *user_data=nullptr)
 install_fatal_error_handler - Installs a new error handler to be used whenever a serious (non-recoverable) error is encountered by LLVM. More...
 
void remove_fatal_error_handler ()
 Restores default error handling behaviour.
 
LLVM_ATTRIBUTE_NORETURN void report_fatal_error (const char *reason, bool gen_crash_diag=true)
 Reports a serious error, calling any installed error handler. More...
 
LLVM_ATTRIBUTE_NORETURN void report_fatal_error (const std::string &reason, bool gen_crash_diag=true)
 
LLVM_ATTRIBUTE_NORETURN void report_fatal_error (StringRef reason, bool gen_crash_diag=true)
 
LLVM_ATTRIBUTE_NORETURN void report_fatal_error (const Twine &reason, bool gen_crash_diag=true)
 
void install_bad_alloc_error_handler (fatal_error_handler_t handler, void *user_data=nullptr)
 Installs a new bad alloc error handler that should be used whenever a bad alloc error, e.g. More...
 
void remove_bad_alloc_error_handler ()
 Restores default bad alloc error handling behavior.
 
void install_out_of_memory_new_handler ()
 
void report_bad_alloc_error (const char *Reason, bool GenCrashDiag=true)
 Reports a bad alloc error, calling any user defined bad alloc error handler. More...
 
LLVM_ATTRIBUTE_NORETURN void wpi_unreachable_internal (const char *msg=nullptr, const char *file=nullptr, unsigned line=0)
 This function calls abort(), and prints the optional message to stderr. More...
 
char hexdigit (unsigned X, bool LowerCase=false)
 hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).
 
StringRef toStringRef (bool B)
 Construct a string ref from a boolean.
 
StringRef toStringRef (ArrayRef< uint8_t > Input)
 Construct a string ref from an array ref of unsigned chars.
 
ArrayRef< uint8_t > arrayRefFromStringRef (StringRef Input)
 Construct a string ref from an array ref of unsigned chars.
 
unsigned hexDigitValue (char C)
 Interpret the given character C as a hexadecimal digit and return its value. More...
 
bool isDigit (char C)
 Checks if character C is one of the 10 decimal digits.
 
bool isHexDigit (char C)
 Checks if character C is a hexadecimal numeric character.
 
bool isAlpha (char C)
 Checks if character C is a valid letter as classified by "C" locale.
 
bool isAlnum (char C)
 Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classified by "C" locale.
 
bool isASCII (char C)
 Checks whether character C is valid ASCII (high bit is zero).
 
bool isASCII (wpi::StringRef S)
 Checks whether all characters in S are ASCII.
 
bool isPrint (char C)
 Checks whether character C is printable. More...
 
char toLower (char x)
 Returns the corresponding lowercase character if x is uppercase.
 
char toUpper (char x)
 Returns the corresponding uppercase character if x is lowercase.
 
std::string utohexstr (uint64_t X, bool LowerCase=false)
 
std::string toHex (StringRef Input, bool LowerCase=false)
 Convert buffer Input to its hexadecimal representation. More...
 
std::string toHex (ArrayRef< uint8_t > Input, bool LowerCase=false)
 
uint8_t hexFromNibbles (char MSB, char LSB)
 
std::string fromHex (StringRef Input)
 Convert hexadecimal string Input to its binary representation. More...
 
template<typename N >
bool to_integer (StringRef S, N &Num, unsigned Base=0)
 Convert the string S to an integer of the specified type using the radix Base. More...
 
bool to_float (const Twine &T, float &Num)
 
bool to_float (const Twine &T, double &Num)
 
bool to_float (const Twine &T, long double &Num)
 
std::string utostr (uint64_t X, bool isNeg=false)
 
std::string itostr (int64_t X)
 
StringRef::size_type StrInStrNoCase (StringRef s1, StringRef s2)
 StrInStrNoCase - Portable version of strcasestr. More...
 
std::pair< StringRef, StringRefgetToken (StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
 getToken - This function extracts one token from source, ignoring any leading characters that appear in the Delimiters string, and ending the token at any of the characters that appear in the Delimiters string. More...
 
void SplitString (StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")
 SplitString - Split up the specified string according to the specified delimiters, appending the result fragments to the output list.
 
static unsigned HashString (StringRef Str, unsigned Result=0)
 HashString - Hash function for strings. More...
 
StringRef getOrdinalSuffix (unsigned Val)
 Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th).
 
void printEscapedString (StringRef Name, raw_ostream &Out)
 Print each character of the specified string, escaping it if it is not printable or if it is an escape char.
 
void printHTMLEscaped (StringRef String, raw_ostream &Out)
 Print each character of the specified string, escaping HTML special characters.
 
void printLowerCase (StringRef String, raw_ostream &Out)
 printLowerCase - Print each character as lowercase if it is uppercase.
 
template<typename IteratorT >
std::string join (IteratorT Begin, IteratorT End, StringRef Separator)
 Joins the strings in the range [Begin, End), adding Separator between the elements.
 
template<typename Range >
std::string join (Range &&R, StringRef Separator)
 Joins the strings in the range [R.begin(), R.end()), adding Separator between the elements.
 
template<typename Sep , typename... Args>
std::string join_items (Sep Separator, Args &&... Items)
 Joins the strings in the parameter pack Items, adding Separator between the elements. More...
 
template<class T , class E >
std::enable_if< std::is_error_code_enum< E >::value||std::is_error_condition_enum< E >::value, bool >::type operator== (const ErrorOr< T > &Err, E Code)
 
template<typename T >
std::vector< T >::iterator insert_sorted (std::vector< T > &vec, T const &item)
 
ConversionResult ConvertUTF8toUTF16 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
 
ConversionResult ConvertUTF8toUTF32Partial (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
 Convert a partial UTF8 sequence to UTF32. More...
 
ConversionResult ConvertUTF8toUTF32 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
 Convert a partial UTF8 sequence to UTF32. More...
 
ConversionResult ConvertUTF16toUTF8 (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
 
ConversionResult ConvertUTF32toUTF8 (const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
 
ConversionResult ConvertUTF16toUTF32 (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
 
ConversionResult ConvertUTF32toUTF16 (const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
 
Boolean isLegalUTF8Sequence (const UTF8 *source, const UTF8 *sourceEnd)
 
Boolean isLegalUTF8String (const UTF8 **source, const UTF8 *sourceEnd)
 
unsigned getNumBytesForUTF8 (UTF8 firstByte)
 
bool ConvertCodePointToUTF8 (unsigned Source, char *&ResultPtr)
 Convert an Unicode code point to UTF8 sequence. More...
 
static ConversionResult convertUTF8Sequence (const UTF8 **source, const UTF8 *sourceEnd, UTF32 *target, ConversionFlags flags)
 Convert the first UTF8 sequence in the given source buffer to a UTF32 code point. More...
 
bool hasUTF16ByteOrderMark (ArrayRef< char > SrcBytes)
 Returns true if a blob of text starts with a UTF-16 big or little endian byte order mark.
 
bool convertUTF16ToUTF8String (ArrayRef< UTF16 > SrcUTF16, SmallVectorImpl< char > &DstUTF8)
 Converts a UTF-16 string into a UTF-8 string. More...
 
bool convertUTF8ToUTF16String (StringRef SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
 Converts a UTF-8 string into a UTF-16 string with native endianness. More...
 
template<typename T >
future< T > make_ready_future (T &&value)
 Constructs a valid future with the value set.
 
future< void > make_ready_future ()
 Constructs a valid future with the value set.
 
template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool operator== (const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &LHS, const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &RHS)
 Equality comparison for DenseMap. More...
 
template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool operator!= (const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &LHS, const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &RHS)
 Inequality comparison for DenseMap. More...
 
template<typename KeyT , typename ValueT , typename KeyInfoT >
size_t capacity_in_bytes (const DenseMap< KeyT, ValueT, KeyInfoT > &X)
 
void * allocate_buffer (size_t Size, size_t Alignment)
 Allocate a buffer of memory with the given size and alignment. More...
 
void deallocate_buffer (void *Ptr, size_t Size, size_t Alignment)
 Deallocate a buffer of memory with the given size and alignment. More...
 
template<typename T >
std::size_t countTrailingZeros (T Val, ZeroBehavior ZB=ZB_Width)
 Count number of 0's from the least significant bit to the most stopping at the first 1. More...
 
template<typename T >
std::size_t countLeadingZeros (T Val, ZeroBehavior ZB=ZB_Width)
 Count number of 0's from the most significant bit to the least stopping at the first 1. More...
 
template<typename T >
findFirstSet (T Val, ZeroBehavior ZB=ZB_Max)
 Get the index of the first set bit starting from the least significant bit. More...
 
template<typename T >
maskTrailingOnes (unsigned N)
 Create a bitmask with the N right-most bits set to 1, and all other bits set to 0. More...
 
template<typename T >
maskLeadingOnes (unsigned N)
 Create a bitmask with the N left-most bits set to 1, and all other bits set to 0. More...
 
template<typename T >
maskTrailingZeros (unsigned N)
 Create a bitmask with the N right-most bits set to 0, and all other bits set to 1. More...
 
template<typename T >
maskLeadingZeros (unsigned N)
 Create a bitmask with the N left-most bits set to 0, and all other bits set to 1. More...
 
template<typename T >
findLastSet (T Val, ZeroBehavior ZB=ZB_Max)
 Get the index of the last set bit starting from the least significant bit. More...
 
template<typename T >
reverseBits (T Val)
 Reverse the bits in Val.
 
constexpr uint32_t Hi_32 (uint64_t Value)
 Return the high 32 bits of a 64 bit value.
 
constexpr uint32_t Lo_32 (uint64_t Value)
 Return the low 32 bits of a 64 bit value.
 
constexpr uint64_t Make_64 (uint32_t High, uint32_t Low)
 Make a 64-bit integer from a high / low pair of 32-bit integers.
 
template<unsigned N>
constexpr bool isInt (int64_t x)
 Checks if an integer fits into the given bit width.
 
template<>
constexpr bool isInt< 8 > (int64_t x)
 
template<>
constexpr bool isInt< 16 > (int64_t x)
 
template<>
constexpr bool isInt< 32 > (int64_t x)
 
template<unsigned N, unsigned S>
constexpr bool isShiftedInt (int64_t x)
 Checks if a signed integer is an N bit number shifted left by S.
 
template<unsigned N>
constexpr std::enable_if<(N< 64), bool >::type isUInt (uint64_t X)
 Checks if an unsigned integer fits into the given bit width. More...
 
template<unsigned N>
constexpr bool ::type isUInt (uint64_t X)
 
template<>
constexpr bool isUInt< 8 > (uint64_t x)
 
template<>
constexpr bool isUInt< 16 > (uint64_t x)
 
template<>
constexpr bool isUInt< 32 > (uint64_t x)
 
template<unsigned N, unsigned S>
constexpr bool isShiftedUInt (uint64_t x)
 Checks if a unsigned integer is an N bit number shifted left by S.
 
uint64_t maxUIntN (uint64_t N)
 Gets the maximum value for a N-bit unsigned integer.
 
int64_t minIntN (int64_t N)
 Gets the minimum value for a N-bit signed integer.
 
int64_t maxIntN (int64_t N)
 Gets the maximum value for a N-bit signed integer.
 
bool isUIntN (unsigned N, uint64_t x)
 Checks if an unsigned integer fits into the given (dynamic) bit width.
 
bool isIntN (unsigned N, int64_t x)
 Checks if an signed integer fits into the given (dynamic) bit width.
 
constexpr bool isMask_32 (uint32_t Value)
 Return true if the argument is a non-empty sequence of ones starting at the least significant bit with the remainder zero (32 bit version). More...
 
constexpr bool isMask_64 (uint64_t Value)
 Return true if the argument is a non-empty sequence of ones starting at the least significant bit with the remainder zero (64 bit version).
 
constexpr bool isShiftedMask_32 (uint32_t Value)
 Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit version.) Ex. More...
 
constexpr bool isShiftedMask_64 (uint64_t Value)
 Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit version.)
 
constexpr bool isPowerOf2_32 (uint32_t Value)
 Return true if the argument is a power of two > 0. More...
 
constexpr bool isPowerOf2_64 (uint64_t Value)
 Return true if the argument is a power of two > 0 (64 bit edition.)
 
template<typename T >
std::size_t countLeadingOnes (T Value, ZeroBehavior ZB=ZB_Width)
 Count the number of ones from the most significant bit to the first zero bit. More...
 
template<typename T >
std::size_t countTrailingOnes (T Value, ZeroBehavior ZB=ZB_Width)
 Count the number of ones from the least significant bit to the first zero bit. More...
 
template<typename T >
unsigned countPopulation (T Value)
 Count the number of set bits in a value. More...
 
double Log2 (double Value)
 Return the log base 2 of the specified value.
 
unsigned Log2_32 (uint32_t Value)
 Return the floor log base 2 of the specified value, -1 if the value is zero. More...
 
unsigned Log2_64 (uint64_t Value)
 Return the floor log base 2 of the specified value, -1 if the value is zero. More...
 
unsigned Log2_32_Ceil (uint32_t Value)
 Return the ceil log base 2 of the specified value, 32 if the value is zero. More...
 
unsigned Log2_64_Ceil (uint64_t Value)
 Return the ceil log base 2 of the specified value, 64 if the value is zero. More...
 
uint64_t GreatestCommonDivisor64 (uint64_t A, uint64_t B)
 Return the greatest common divisor of the values using Euclid's algorithm.
 
double BitsToDouble (uint64_t Bits)
 This function takes a 64-bit integer and returns the bit equivalent double.
 
float BitsToFloat (uint32_t Bits)
 This function takes a 32-bit integer and returns the bit equivalent float.
 
uint64_t DoubleToBits (double Double)
 This function takes a double and returns the bit equivalent 64-bit integer. More...
 
uint32_t FloatToBits (float Float)
 This function takes a float and returns the bit equivalent 32-bit integer. More...
 
constexpr uint64_t MinAlign (uint64_t A, uint64_t B)
 A and B are either alignments or offsets. More...
 
uintptr_t alignAddr (const void *Addr, size_t Alignment)
 Aligns Addr to Alignment bytes, rounding up. More...
 
size_t alignmentAdjustment (const void *Ptr, size_t Alignment)
 Returns the necessary adjustment for aligning Ptr to Alignment bytes, rounding up.
 
uint64_t NextPowerOf2 (uint64_t A)
 Returns the next power of two (in 64-bits) that is strictly greater than A. More...
 
uint64_t PowerOf2Floor (uint64_t A)
 Returns the power of two which is less than or equal to the given value. More...
 
uint64_t PowerOf2Ceil (uint64_t A)
 Returns the power of two which is greater than or equal to the given value. More...
 
uint64_t alignTo (uint64_t Value, uint64_t Align, uint64_t Skew=0)
 Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align. More...
 
template<uint64_t Align>
constexpr uint64_t alignTo (uint64_t Value)
 Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align. More...
 
uint64_t divideCeil (uint64_t Numerator, uint64_t Denominator)
 Returns the integer ceil(Numerator / Denominator).
 
uint64_t alignDown (uint64_t Value, uint64_t Align, uint64_t Skew=0)
 Returns the largest uint64_t less than or equal to Value and is Skew mod Align. More...
 
uint64_t OffsetToAlignment (uint64_t Value, uint64_t Align)
 Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align. More...
 
template<unsigned B>
constexpr int32_t SignExtend32 (uint32_t X)
 Sign-extend the number in the bottom B bits of X to a 32-bit integer. More...
 
int32_t SignExtend32 (uint32_t X, unsigned B)
 Sign-extend the number in the bottom B bits of X to a 32-bit integer. More...
 
template<unsigned B>
constexpr int64_t SignExtend64 (uint64_t x)
 Sign-extend the number in the bottom B bits of X to a 64-bit integer. More...
 
int64_t SignExtend64 (uint64_t X, unsigned B)
 Sign-extend the number in the bottom B bits of X to a 64-bit integer. More...
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type AbsoluteDifference (T X, T Y)
 Subtract two unsigned integers, X and Y, of type T and return the absolute value of the result.
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type SaturatingAdd (T X, T Y, bool *ResultOverflowed=nullptr)
 Add two unsigned integers, X and Y, of type T. More...
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type SaturatingMultiply (T X, T Y, bool *ResultOverflowed=nullptr)
 Multiply two unsigned integers, X and Y, of type T. More...
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value, T >::type SaturatingMultiplyAdd (T X, T Y, T A, bool *ResultOverflowed=nullptr)
 Multiply two unsigned integers, X and Y, and add the unsigned integer, A to the product. More...
 
template<typename T >
constexpr int sgn (T val)
 
int SocketErrno ()
 
std::string SocketStrerror (int code)
 
static std::string SocketStrerror ()
 
template<typename RangeT , typename WrappedIteratorT = decltype(std::begin(std::declval<RangeT>()))>
iterator_range< pointee_iterator< WrappedIteratorT > > make_pointee_range (RangeT &&Range)
 
template<typename RangeT , typename WrappedIteratorT = decltype(std::begin(std::declval<RangeT>()))>
iterator_range< pointer_iterator< WrappedIteratorT > > make_pointer_range (RangeT &&Range)
 
bool getAsUnsignedInteger (StringRef Str, unsigned Radix, unsigned long long &Result) noexcept
 Helper functions for StringRef::getAsInteger.
 
bool getAsSignedInteger (StringRef Str, unsigned Radix, long long &Result) noexcept
 
bool consumeUnsignedInteger (StringRef &Str, unsigned Radix, unsigned long long &Result) noexcept
 
bool consumeSignedInteger (StringRef &Str, unsigned Radix, long long &Result) noexcept
 
LLVM_NODISCARD hash_code hash_value (StringRef S)
 Compute a hash_code for a StringRef.
 
size_t Base64Decode (raw_ostream &os, StringRef encoded)
 
size_t Base64Decode (StringRef encoded, std::string *plain)
 
StringRef Base64Decode (StringRef encoded, size_t *num_read, SmallVectorImpl< char > &buf)
 
void Base64Encode (raw_ostream &os, StringRef plain)
 
void Base64Encode (StringRef plain, std::string *encoded)
 
StringRef Base64Encode (StringRef plain, SmallVectorImpl< char > &buf)
 
template<typename ErrT , typename... ArgTs>
Error make_error (ArgTs &&... Args)
 Make a Error instance representing failure using the given error info type.
 
Error joinErrors (Error E1, Error E2)
 Concatenate errors. More...
 
LLVM_ATTRIBUTE_NORETURN void report_fatal_error (Error Err, bool gen_crash_diag=true)
 Report a serious error, calling any installed error handler. More...
 
void cantFail (Error Err, const char *Msg=nullptr)
 Report a fatal error if Err is a failure value. More...
 
template<typename T >
cantFail (Expected< T > ValOrErr, const char *Msg=nullptr)
 Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained value. More...
 
template<typename T >
T & cantFail (Expected< T & > ValOrErr, const char *Msg=nullptr)
 Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained reference. More...
 
Error handleErrorImpl (std::unique_ptr< ErrorInfoBase > Payload)
 
template<typename HandlerT , typename... HandlerTs>
Error handleErrorImpl (std::unique_ptr< ErrorInfoBase > Payload, HandlerT &&Handler, HandlerTs &&... Handlers)
 
template<typename... HandlerTs>
Error handleErrors (Error E, HandlerTs &&... Hs)
 Pass the ErrorInfo(s) contained in E to their respective handlers. More...
 
template<typename... HandlerTs>
void handleAllErrors (Error E, HandlerTs &&... Handlers)
 Behaves the same as handleErrors, except that by contract all errors must be handled by the given handlers (i.e. More...
 
void handleAllErrors (Error E)
 Check that E is a non-error, then drop it. More...
 
template<typename T , typename RecoveryFtor , typename... HandlerTs>
Expected< T > handleExpected (Expected< T > ValOrErr, RecoveryFtor &&RecoveryPath, HandlerTs &&... Handlers)
 Handle any errors (if present) in an Expected<T>, then try a recovery path. More...
 
void logAllUnhandledErrors (Error E, raw_ostream &OS, Twine ErrorBanner={})
 Log all errors (if any) in E to OS. More...
 
std::string toString (Error E)
 Write all error messages (if any) in E to a string. More...
 
void consumeError (Error Err)
 Consume a Error without doing anything. More...
 
bool errorToBool (Error Err)
 Helper for converting an Error to a bool. More...
 
std::error_code inconvertibleErrorCode ()
 The value returned by this function can be returned from convertToErrorCode for Error values where no sensible translation to std::error_code exists. More...
 
Error errorCodeToError (std::error_code EC)
 Helper for converting an std::error_code to a Error.
 
std::error_code errorToErrorCode (Error Err)
 Helper for converting an ECError to a std::error_code. More...
 
template<typename T >
Expected< T > errorOrToExpected (ErrorOr< T > &&EO)
 Convert an ErrorOr<T> to an Expected<T>.
 
template<typename T >
ErrorOr< T > expectedToErrorOr (Expected< T > &&E)
 Convert an Expected<T> to an ErrorOr<T>.
 
template<typename... Ts>
Error createStringError (std::error_code EC, char const *Fmt, const Ts &... Vals)
 Create formatted StringError object.
 
Error createStringError (std::error_code EC, char const *Msg)
 
Error createFileError (std::string F, Error E)
 Concatenate a source file path and/or name with an Error. More...
 
Error createFileError (std::string F, ErrorSuccess)=delete
 
void wpi_shutdown ()
 wpi_shutdown - Deallocate and destroy all ManagedStatic variables.
 
std::error_code mapWindowsError (unsigned EV)
 
raw_ostreamoperator<< (raw_ostream &Out, const VersionTuple &V)
 Print a version number.
 
raw_ostreamouts ()
 This returns a reference to a raw_ostream for standard output. More...
 
raw_ostreamerrs ()
 This returns a reference to a raw_ostream for standard error. More...
 
raw_ostreamnulls ()
 This returns a reference to a raw_ostream which simply discards output.
 
std::string GetStackTrace (int offset)
 Get a stack trace, ignoring the first "offset" symbols. More...
 
template<class T >
void deleter (T *Ptr)
 
template<typename ContainerTy >
auto adl_begin (ContainerTy &&container) -> decltype(adl_detail::adl_begin(std::forward< ContainerTy >(container)))
 
template<typename ContainerTy >
auto adl_end (ContainerTy &&container) -> decltype(adl_detail::adl_end(std::forward< ContainerTy >(container)))
 
template<typename T >
void adl_swap (T &&lhs, T &&rhs) noexcept(noexcept(adl_detail::adl_swap(std::declval< T >(), std::declval< T >())))
 
template<typename T >
constexpr bool empty (const T &RangeOrContainer)
 Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
 
template<class ItTy , class FuncTy >
mapped_iterator< ItTy, FuncTy > map_iterator (ItTy I, FuncTy F)
 
template<typename ContainerTy >
auto reverse (ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
 
template<typename IteratorTy >
std::reverse_iterator< IteratorTy > make_reverse_iterator (IteratorTy It)
 
template<typename ContainerTy >
auto reverse (ContainerTy &&C, typename std::enable_if<!has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(wpi::make_reverse_iterator(std::end(C)), wpi::make_reverse_iterator(std::begin(C))))
 
template<typename RangeT , typename PredicateT >
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range (RangeT &&Range, PredicateT Pred)
 Convenience function that takes a range of elements and a predicate, and return a new filter_iterator range. More...
 
template<typename R , typename UnaryPredicate >
bool all_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
bool any_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
 
template<typename T , typename U , typename... Args>
detail::zippy< detail::zip_shortest, T, U, Args... > zip (T &&t, U &&u, Args &&... args)
 zip iterator for two or more iteratable types.
 
template<typename T , typename U , typename... Args>
detail::zippy< detail::zip_first, T, U, Args... > zip_first (T &&t, U &&u, Args &&... args)
 zip iterator that, for the sake of efficiency, assumes the first iteratee to be the shortest.
 
template<typename T , typename U , typename... Args>
detail::zip_longest_range< T, U, Args... > zip_longest (T &&t, U &&u, Args &&... args)
 Iterate over two or more iterators at the same time. More...
 
template<typename ValueT , typename... RangeTs>
detail::concat_range< ValueT, RangeTs... > concat (RangeTs &&... Ranges)
 Concatenated range across two or more ranges. More...
 
template<class T , std::size_t N>
constexpr size_t array_lengthof (T(&)[N])
 Find the length of an array.
 
template<typename T >
int array_pod_sort_comparator (const void *P1, const void *P2)
 Adapt std::less<T> for array_pod_sort.
 
template<class IteratorTy >
void array_pod_sort (IteratorTy Start, IteratorTy End)
 array_pod_sort - This sorts an array with the specified start and end extent. More...
 
template<class IteratorTy >
void array_pod_sort (IteratorTy Start, IteratorTy End, int(*Compare)(const typename std::iterator_traits< IteratorTy >::value_type *, const typename std::iterator_traits< IteratorTy >::value_type *))
 
template<typename Container >
void DeleteContainerPointers (Container &C)
 For a container of pointers, deletes the pointers and then clears the container.
 
template<typename Container >
void DeleteContainerSeconds (Container &C)
 In a container of pairs (usually a map) whose second element is a pointer, deletes the second elements and then clears the container.
 
template<typename R >
auto size (R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
 Get the size of a range. More...
 
template<typename R , typename UnaryPredicate >
UnaryPredicate for_each (R &&Range, UnaryPredicate P)
 Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
bool none_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename T >
auto find (R &&Range, const T &Val) -> decltype(adl_begin(Range))
 Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
auto find_if (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
auto find_if_not (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 
template<typename R , typename UnaryPredicate >
auto remove_if (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt copy_if (R &&Range, OutputIt Out, UnaryPredicate P)
 Provide wrappers to std::copy_if which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename OutputIt >
OutputIt copy (R &&Range, OutputIt Out)
 
template<typename R , typename E >
bool is_contained (R &&Range, const E &Element)
 Wrapper function around std::find to detect if an element exists in a container.
 
template<typename R , typename E >
auto count (R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
 Wrapper function around std::count to count the number of times an element Element occurs in the given range Range.
 
template<typename R , typename UnaryPredicate >
auto count_if (R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
 Wrapper function around std::count_if to count the number of times an element satisfying a given predicate occurs in a range.
 
template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt transform (R &&Range, OutputIt d_first, UnaryPredicate P)
 Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
 
template<typename R , typename UnaryPredicate >
auto partition (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename ForwardIt >
auto lower_bound (R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
 Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename ForwardIt , typename Compare >
auto lower_bound (R &&Range, ForwardIt I, Compare C) -> decltype(adl_begin(Range))
 
template<typename R , typename ForwardIt >
auto upper_bound (R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
 Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename ForwardIt , typename Compare >
auto upper_bound (R &&Range, ForwardIt I, Compare C) -> decltype(adl_begin(Range))
 
template<typename R >
bool is_splat (R &&Range)
 Wrapper function around std::equal to detect if all elements in a container are same.
 
template<unsigned Size, typename R >
SmallVector< typename std::remove_const< detail::ValueOfRange< R > >::type, Size > to_vector (R &&Range)
 Given a range of type R, iterate the entire range and return a SmallVector with elements of the vector. More...
 
template<typename Container , typename UnaryPredicate >
void erase_if (Container &C, UnaryPredicate P)
 Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent to: More...
 
template<typename R >
detail::enumerator< R > enumerate (R &&TheRange)
 Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based index of the item in the sequence, and B is the value from the original sequence. More...
 
template<typename IterTy >
bool hasNItems (IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
 Return true if the sequence [Begin, End) has exactly N items. More...
 
template<typename IterTy >
bool hasNItemsOrMore (IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
 Return true if the sequence [Begin, End) has N or more items. More...
 
uint64_t SizeUleb128 (uint64_t val)
 Get size of unsigned LEB128 data @val: value. More...
 
uint64_t WriteUleb128 (SmallVectorImpl< char > &dest, uint64_t val)
 Write unsigned LEB128 data @addr: the address where the ULEB128 data is to be stored @val: value to be stored. More...
 
uint64_t ReadUleb128 (const char *addr, uint64_t *ret)
 Read unsigned LEB128 data @addr: the address where the ULEB128 data is stored @ret: address to store the result. More...
 
bool ReadUleb128 (raw_istream &is, uint64_t *ret)
 Read unsigned LEB128 data from a stream @is: the input stream where the ULEB128 data is to be read from @ret: address to store the result. More...
 
template<class T >
iterator_range< T > make_range (T x, T y)
 Convenience function for iterating over sub-ranges. More...
 
template<typename T >
iterator_range< T > make_range (std::pair< T, T > p)
 
template<typename T >
iterator_range< decltype(adl_begin(std::declval< T >)))> drop_begin (T &&t, int n)
 
raw_ostreamoperator<< (raw_ostream &OS, sys::TimePoint<> TP)
 
std::string Demangle (const Twine &mangledSymbol)
 Demangle a C++ symbol. More...
 
std::string GetHostname ()
 
StringRef GetHostname (SmallVectorImpl< char > &name)
 
StringRef UnescapeURI (const Twine &str, SmallVectorImpl< char > &buf, bool *error)
 
StringRef EscapeURI (const Twine &str, SmallVectorImpl< char > &buf, bool spacePlus=true)
 
bool ParseHttpHeaders (raw_istream &is, SmallVectorImpl< char > *contentType, SmallVectorImpl< char > *contentLength)
 
bool FindMultipartBoundary (wpi::raw_istream &is, StringRef boundary, std::string *saveBuf)
 
template<class T , class U >
bool operator== (const IntrusiveRefCntPtr< T > &A, const IntrusiveRefCntPtr< U > &B)
 
template<class T , class U >
bool operator!= (const IntrusiveRefCntPtr< T > &A, const IntrusiveRefCntPtr< U > &B)
 
template<class T , class U >
bool operator== (const IntrusiveRefCntPtr< T > &A, U *B)
 
template<class T , class U >
bool operator!= (const IntrusiveRefCntPtr< T > &A, U *B)
 
template<class T , class U >
bool operator== (T *A, const IntrusiveRefCntPtr< U > &B)
 
template<class T , class U >
bool operator!= (T *A, const IntrusiveRefCntPtr< U > &B)
 
template<class T >
bool operator== (std::nullptr_t A, const IntrusiveRefCntPtr< T > &B)
 
template<class T >
bool operator== (const IntrusiveRefCntPtr< T > &A, std::nullptr_t B)
 
template<class T >
bool operator!= (std::nullptr_t A, const IntrusiveRefCntPtr< T > &B)
 
template<class T >
bool operator!= (const IntrusiveRefCntPtr< T > &A, std::nullptr_t B)
 
template<typename ValueTy >
bool operator== (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename ValueTy >
bool operator!= (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename ValueTy >
bool operator< (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename ValueTy >
bool operator<= (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename ValueTy >
bool operator> (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename ValueTy >
bool operator>= (const StringMap< ValueTy > &lhs, const StringMap< ValueTy > &rhs)
 
template<typename T , unsigned N>
size_t capacity_in_bytes (const SmallVector< T, N > &X)
 
template<typename PT1 , typename PT2 >
bool operator== (PointerUnion< PT1, PT2 > lhs, PointerUnion< PT1, PT2 > rhs)
 
template<typename PT1 , typename PT2 >
bool operator!= (PointerUnion< PT1, PT2 > lhs, PointerUnion< PT1, PT2 > rhs)
 
template<typename PT1 , typename PT2 >
bool operator< (PointerUnion< PT1, PT2 > lhs, PointerUnion< PT1, PT2 > rhs)
 
template<typename PT1 , typename PT2 , typename PT3 >
bool operator< (PointerUnion3< PT1, PT2, PT3 > lhs, PointerUnion3< PT1, PT2, PT3 > rhs)
 
template<typename... Ts>
format_object< Ts... > format (const char *Fmt, const Ts &... Vals)
 These are helper functions used to produce formatted output. More...
 
FormattedString left_justify (StringRef Str, unsigned Width)
 left_justify - append spaces after string so total output is Width characters. More...
 
FormattedString right_justify (StringRef Str, unsigned Width)
 right_justify - add spaces before string so total output is Width characters. More...
 
FormattedString center_justify (StringRef Str, unsigned Width)
 center_justify - add spaces before and after string so total output is Width characters. More...
 
FormattedNumber format_hex (uint64_t N, unsigned Width, bool Upper=false)
 format_hex - Output N as a fixed width hexadecimal. More...
 
FormattedNumber format_hex_no_prefix (uint64_t N, unsigned Width, bool Upper=false)
 format_hex_no_prefix - Output N as a fixed width hexadecimal. More...
 
FormattedNumber format_decimal (int64_t N, unsigned Width)
 format_decimal - Output N as a right justified, fixed-width decimal. More...
 
FormattedBytes format_bytes (ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
 
FormattedBytes format_bytes_with_ascii (ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
 
std::error_code make_error_code (errc E)
 
size_t getDefaultPrecision (FloatStyle Style)
 
bool isPrefixedHexStyle (HexPrintStyle S)
 
void write_integer (raw_ostream &S, unsigned int N, size_t MinDigits, IntegerStyle Style)
 
void write_integer (raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style)
 
void write_integer (raw_ostream &S, unsigned long N, size_t MinDigits, IntegerStyle Style)
 
void write_integer (raw_ostream &S, long N, size_t MinDigits, IntegerStyle Style)
 
void write_integer (raw_ostream &S, unsigned long long N, size_t MinDigits, IntegerStyle Style)
 
void write_integer (raw_ostream &S, long long N, size_t MinDigits, IntegerStyle Style)
 
void write_hex (raw_ostream &S, uint64_t N, HexPrintStyle Style, std::optional< size_t > Width=std::nullopt)
 
void write_double (raw_ostream &S, double D, FloatStyle Style, std::optional< size_t > Precision=std::nullopt)
 
template<typename T >
hash_code hash_value (ArrayRef< T > S)
 
unsigned long http_parser_version (void)
 
void http_parser_init (http_parser *parser, enum http_parser_type type)
 
void http_parser_settings_init (http_parser_settings *settings)
 
size_t http_parser_execute (http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
 
int http_should_keep_alive (const http_parser *parser)
 
const char * http_method_str (enum http_method m)
 
const char * http_status_str (enum http_status s)
 
const char * http_errno_name (enum http_errno err)
 
const char * http_errno_description (enum http_errno err)
 
void http_parser_url_init (struct http_parser_url *u)
 
int http_parser_parse_url (const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
 
void http_parser_pause (http_parser *parser, int paused)
 
int http_body_is_final (const http_parser *parser)
 
template<typename T >
std::enable_if< is_integral_or_enum< T >::value, hash_code >::type hash_value (T value)
 Compute a hash_code for any integer value. More...
 
template<typename T >
hash_code hash_value (const T *ptr)
 Compute a hash_code for a pointer's address. More...
 
template<typename T , typename U >
hash_code hash_value (const std::pair< T, U > &arg)
 Compute a hash_code for a pair of objects.
 
template<typename T >
hash_code hash_value (const std::basic_string< T > &arg)
 Compute a hash_code for a standard string.
 
void set_fixed_execution_hash_seed (uint64_t fixed_value)
 Override the execution seed with a fixed value. More...
 
template<typename InputIteratorT >
hash_code hash_combine_range (InputIteratorT first, InputIteratorT last)
 Compute a hash_code for a sequence of values. More...
 
template<typename ... Ts>
hash_code hash_combine (const Ts &...args)
 Combine values into a single hash_code. More...
 
StringRef Comparison Operators
LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator== (StringRef LHS, StringRef RHS) noexcept
 
LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator!= (StringRef LHS, StringRef RHS) noexcept
 
bool operator< (StringRef LHS, StringRef RHS) noexcept
 
bool operator<= (StringRef LHS, StringRef RHS) noexcept
 
bool operator> (StringRef LHS, StringRef RHS) noexcept
 
bool operator>= (StringRef LHS, StringRef RHS) noexcept
 
bool operator== (StringRef LHS, const char *RHS) noexcept
 
bool operator!= (StringRef LHS, const char *RHS) noexcept
 
bool operator< (StringRef LHS, const char *RHS) noexcept
 
bool operator<= (StringRef LHS, const char *RHS) noexcept
 
bool operator> (StringRef LHS, const char *RHS) noexcept
 
bool operator>= (StringRef LHS, const char *RHS) noexcept
 
bool operator== (const char *LHS, StringRef RHS) noexcept
 
bool operator!= (const char *LHS, StringRef RHS) noexcept
 
bool operator< (const char *LHS, StringRef RHS) noexcept
 
bool operator<= (const char *LHS, StringRef RHS) noexcept
 
bool operator> (const char *LHS, StringRef RHS) noexcept
 
bool operator>= (const char *LHS, StringRef RHS) noexcept
 
std::string & operator+= (std::string &buffer, StringRef string)
 
std::ostream & operator<< (std::ostream &os, StringRef string)
 
Twine Inline Implementations
Twine operator+ (const Twine &LHS, const Twine &RHS)
 
Twine operator+ (const char *LHS, const StringRef &RHS)
 Additional overload to guarantee simplified codegen; this is equivalent to concat().
 
Twine operator+ (const StringRef &LHS, const char *RHS)
 Additional overload to guarantee simplified codegen; this is equivalent to concat().
 
raw_ostreamoperator<< (raw_ostream &OS, const Twine &RHS)
 
ArrayRef Convenience constructors
template<typename T >
ArrayRef< T > makeArrayRef (const T &OneElt)
 Construct an ArrayRef from a single element.
 
template<typename T >
ArrayRef< T > makeArrayRef (const T *data, size_t length)
 Construct an ArrayRef from a pointer and length.
 
template<typename T >
ArrayRef< T > makeArrayRef (const T *begin, const T *end)
 Construct an ArrayRef from a range.
 
template<typename T >
ArrayRef< T > makeArrayRef (const SmallVectorImpl< T > &Vec)
 Construct an ArrayRef from a SmallVector.
 
template<typename T , unsigned N>
ArrayRef< T > makeArrayRef (const SmallVector< T, N > &Vec)
 Construct an ArrayRef from a SmallVector.
 
template<typename T >
ArrayRef< T > makeArrayRef (const std::vector< T > &Vec)
 Construct an ArrayRef from a std::vector.
 
template<typename T >
ArrayRef< T > makeArrayRef (const ArrayRef< T > &Vec)
 Construct an ArrayRef from an ArrayRef (no-op) (const)
 
template<typename T >
ArrayRef< T > & makeArrayRef (ArrayRef< T > &Vec)
 Construct an ArrayRef from an ArrayRef (no-op)
 
template<typename T , size_t N>
ArrayRef< T > makeArrayRef (const T(&Arr)[N])
 Construct an ArrayRef from a C array.
 
template<typename T >
MutableArrayRef< T > makeMutableArrayRef (T &OneElt)
 Construct a MutableArrayRef from a single element.
 
template<typename T >
MutableArrayRef< T > makeMutableArrayRef (T *data, size_t length)
 Construct a MutableArrayRef from a pointer and length.
 
ArrayRef Comparison Operators
template<typename T >
bool operator== (ArrayRef< T > LHS, ArrayRef< T > RHS)
 
template<typename T >
bool operator!= (ArrayRef< T > LHS, ArrayRef< T > RHS)
 

Variables

static const unsigned char BitReverseTable256 [256]
 Macro compressed bit reversal table for 256 bits. More...
 
constexpr std::nullopt_t nullopt
 
template<typename T >
int(*)(const void *, const void *) get_array_pod_sort_comparator (const T &)
 get_array_pod_sort_comparator - This is an internal helper function used to get type deduction of T right.
 

Detailed Description

WPILib C++ utilities (wpiutil) namespace.

Enumeration Type Documentation

◆ ZeroBehavior

The behavior an operation has on an input of 0.

Enumerator
ZB_Undefined 

The returned value is undefined.

ZB_Max 

The returned value is numeric_limits<T>::max()

ZB_Width 

The returned value is numeric_limits<T>::digits.

Function Documentation

◆ alignAddr()

uintptr_t wpi::alignAddr ( const void *  Addr,
size_t  Alignment 
)
inline

Aligns Addr to Alignment bytes, rounding up.

Alignment should be a power of two. This method rounds up, so alignAddr(7, 4) == 8 and alignAddr(8, 4) == 8.

◆ alignDown()

uint64_t wpi::alignDown ( uint64_t  Value,
uint64_t  Align,
uint64_t  Skew = 0 
)
inline

Returns the largest uint64_t less than or equal to Value and is Skew mod Align.

Align must be non-zero

◆ alignTo() [1/2]

template<uint64_t Align>
constexpr uint64_t wpi::alignTo ( uint64_t  Value)
inlineconstexpr

Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align.

Align must be non-zero.

◆ alignTo() [2/2]

uint64_t wpi::alignTo ( uint64_t  Value,
uint64_t  Align,
uint64_t  Skew = 0 
)
inline

Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align.

Align must be non-zero.

If non-zero Skew is specified, the return value will be a minimal integer that is greater than or equal to Value and equal to Align * N + Skew for some integer N. If Skew is larger than Align, its value is adjusted to 'Skew mod Align'.

Examples:

alignTo(5, 8) = 8
alignTo(17, 8) = 24
alignTo(~0LL, 8) = 0
alignTo(321, 255) = 510
alignTo(5, 8, 7) = 7
alignTo(17, 8, 1) = 17
alignTo(~0LL, 8, 3) = 3
alignTo(321, 255, 42) = 552

◆ allocate_buffer()

void* wpi::allocate_buffer ( size_t  Size,
size_t  Alignment 
)
inline

Allocate a buffer of memory with the given size and alignment.

When the compiler supports aligned operator new, this will use it to to handle even over-aligned allocations.

However, this doesn't make any attempt to leverage the fancier techniques like posix_memalign due to portability. It is mostly intended to allow compatibility with platforms that, after aligned allocation was added, use reduced default alignment.

◆ array_pod_sort()

template<class IteratorTy >
void wpi::array_pod_sort ( IteratorTy  Start,
IteratorTy  End 
)
inline

array_pod_sort - This sorts an array with the specified start and end extent.

This is just like std::sort, except that it calls qsort instead of using an inlined template. qsort is slightly slower than std::sort, but most sorts are not performance critical in LLVM and std::sort has to be template instantiated for each type, leading to significant measured code bloat. This function should generally be used instead of std::sort where possible.

This function assumes that you have simple POD-like types that can be compared with std::less and can be moved with memcpy. If this isn't true, you should use std::sort.

NOTE: If qsort_r were portable, we could allow a custom comparator and default to std::less.

◆ cantFail() [1/3]

void wpi::cantFail ( Error  Err,
const char *  Msg = nullptr 
)
inline

Report a fatal error if Err is a failure value.

This function can be used to wrap calls to fallible functions ONLY when it is known that the Error will always be a success value. E.g.

// foo only attempts the fallible operation if DoFallibleOperation is
// true. If DoFallibleOperation is false then foo always returns
// Error::success().
Error foo(bool DoFallibleOperation);
cantFail(foo(false));

◆ cantFail() [2/3]

template<typename T >
T& wpi::cantFail ( Expected< T & >  ValOrErr,
const char *  Msg = nullptr 
)

Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained reference.

This function can be used to wrap calls to fallible functions ONLY when it is known that the Error will always be a success value. E.g.

// foo only attempts the fallible operation if DoFallibleOperation is
// true. If DoFallibleOperation is false then foo always returns a Bar&.
Expected<Bar&> foo(bool DoFallibleOperation);
Bar &X = cantFail(foo(false));

◆ cantFail() [3/3]

template<typename T >
T wpi::cantFail ( Expected< T >  ValOrErr,
const char *  Msg = nullptr 
)

Report a fatal error if ValOrErr is a failure value, otherwise unwraps and returns the contained value.

This function can be used to wrap calls to fallible functions ONLY when it is known that the Error will always be a success value. E.g.

// foo only attempts the fallible operation if DoFallibleOperation is
// true. If DoFallibleOperation is false then foo always returns an int.
Expected<int> foo(bool DoFallibleOperation);
int X = cantFail(foo(false));

◆ center_justify()

FormattedString wpi::center_justify ( StringRef  Str,
unsigned  Width 
)
inline

center_justify - add spaces before and after string so total output is Width characters.

If Str is larger that Width, full string is written with no padding.

◆ concat()

template<typename ValueT , typename... RangeTs>
detail::concat_range<ValueT, RangeTs...> wpi::concat ( RangeTs &&...  Ranges)

Concatenated range across two or more ranges.

The desired value type must be explicitly specified.

◆ consumeError()

void wpi::consumeError ( Error  Err)
inline

Consume a Error without doing anything.

This method should be used only where an error can be considered a reasonable and expected return value.

Uses of this method are potentially indicative of design problems: If it's legitimate to do nothing while processing an "error", the error-producer might be more clearly refactored to return an Optional<T>.

◆ ConvertCodePointToUTF8()

bool wpi::ConvertCodePointToUTF8 ( unsigned  Source,
char *&  ResultPtr 
)

Convert an Unicode code point to UTF8 sequence.

Parameters
Sourcea Unicode code point.
[in,out]ResultPtrpointer to the output buffer, needs to be at least UNI_MAX_UTF8_BYTES_PER_CODE_POINT bytes. On success ResultPtr is updated one past end of the converted sequence.
Returns
true on success.

◆ convertUTF16ToUTF8String()

bool wpi::convertUTF16ToUTF8String ( ArrayRef< UTF16 >  SrcUTF16,
SmallVectorImpl< char > &  DstUTF8 
)

Converts a UTF-16 string into a UTF-8 string.

Returns
true on success

◆ convertUTF8Sequence()

static ConversionResult wpi::convertUTF8Sequence ( const UTF8 **  source,
const UTF8 *  sourceEnd,
UTF32 *  target,
ConversionFlags  flags 
)
inlinestatic

Convert the first UTF8 sequence in the given source buffer to a UTF32 code point.

Parameters
[in,out]sourceA pointer to the source buffer. If the conversion succeeds, this pointer will be updated to point to the byte just past the end of the converted sequence.
sourceEndA pointer just past the end of the source buffer.
[out]targetThe converted code
flagsWhether the conversion is strict or lenient.
Returns
conversionOK on success
See also
ConvertUTF8toUTF32

◆ convertUTF8ToUTF16String()

bool wpi::convertUTF8ToUTF16String ( StringRef  SrcUTF8,
SmallVectorImpl< UTF16 > &  DstUTF16 
)

Converts a UTF-8 string into a UTF-16 string with native endianness.

Returns
true on success

◆ ConvertUTF8toUTF32()

ConversionResult wpi::ConvertUTF8toUTF32 ( const UTF8 **  sourceStart,
const UTF8 *  sourceEnd,
UTF32 **  targetStart,
UTF32 *  targetEnd,
ConversionFlags  flags 
)

Convert a partial UTF8 sequence to UTF32.

If the sequence ends in an incomplete code unit sequence, returns sourceIllegal.

◆ ConvertUTF8toUTF32Partial()

ConversionResult wpi::ConvertUTF8toUTF32Partial ( const UTF8 **  sourceStart,
const UTF8 *  sourceEnd,
UTF32 **  targetStart,
UTF32 *  targetEnd,
ConversionFlags  flags 
)

Convert a partial UTF8 sequence to UTF32.

If the sequence ends in an incomplete code unit sequence, returns sourceExhausted.

◆ countLeadingOnes()

template<typename T >
std::size_t wpi::countLeadingOnes ( Value,
ZeroBehavior  ZB = ZB_Width 
)

Count the number of ones from the most significant bit to the first zero bit.

Ex. countLeadingOnes(0xFF0FFF00) == 8. Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of all ones. Only ZB_Width and ZB_Undefined are valid arguments.

◆ countLeadingZeros()

template<typename T >
std::size_t wpi::countLeadingZeros ( Val,
ZeroBehavior  ZB = ZB_Width 
)

Count number of 0's from the most significant bit to the least stopping at the first 1.

Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of 0. Only ZB_Width and ZB_Undefined are valid arguments.

◆ countPopulation()

template<typename T >
unsigned wpi::countPopulation ( Value)
inline

Count the number of set bits in a value.

Ex. countPopulation(0xF000F000) = 8 Returns 0 if the word is zero.

◆ countTrailingOnes()

template<typename T >
std::size_t wpi::countTrailingOnes ( Value,
ZeroBehavior  ZB = ZB_Width 
)

Count the number of ones from the least significant bit to the first zero bit.

Ex. countTrailingOnes(0x00FF00FF) == 8. Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of all ones. Only ZB_Width and ZB_Undefined are valid arguments.

◆ countTrailingZeros()

template<typename T >
std::size_t wpi::countTrailingZeros ( Val,
ZeroBehavior  ZB = ZB_Width 
)

Count number of 0's from the least significant bit to the most stopping at the first 1.

Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of 0. Only ZB_Width and ZB_Undefined are valid arguments.

◆ createFileError()

Error wpi::createFileError ( std::string  F,
Error  E 
)
inline

Concatenate a source file path and/or name with an Error.

The resulting Error is unchecked.

◆ deallocate_buffer()

void wpi::deallocate_buffer ( void *  Ptr,
size_t  Size,
size_t  Alignment 
)
inline

Deallocate a buffer of memory with the given size and alignment.

If supported, this will used the sized delete operator. Also if supported, this will pass the alignment to the delete operator.

The pointer must have been allocated with the corresponding new operator, most likely using the above helper.

◆ Demangle()

std::string wpi::Demangle ( const Twine mangledSymbol)

Demangle a C++ symbol.

Parameters
mangledSymbolthe mangled symbol.
Returns
The demangled symbol, or mangledSymbol if demangling fails.

◆ DoubleToBits()

uint64_t wpi::DoubleToBits ( double  Double)
inline

This function takes a double and returns the bit equivalent 64-bit integer.

Note that copying doubles around changes the bits of NaNs on some hosts, notably x86, so this routine cannot be used if these bits are needed.

◆ enumerate()

template<typename R >
detail::enumerator<R> wpi::enumerate ( R &&  TheRange)

Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based index of the item in the sequence, and B is the value from the original sequence.

Example:

std::vector<char> Items = {'A', 'B', 'C', 'D'}; for (auto X : enumerate(Items)) { printf("Item %d - %c\n", X.index(), X.value()); }

Output: Item 0 - A Item 1 - B Item 2 - C Item 3 - D

◆ erase_if()

template<typename Container , typename UnaryPredicate >
void wpi::erase_if ( Container &  C,
UnaryPredicate  P 
)

Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent to:

C.erase(remove_if(C, pred), C.end());

This version works for any container with an erase method call accepting two iterators.

◆ errorToBool()

bool wpi::errorToBool ( Error  Err)
inline

Helper for converting an Error to a bool.

This method returns true if Err is in an error state, or false if it is in a success state. Puts Err in a checked state in both cases (unlike Error::operator bool(), which only does this for success states).

◆ errorToErrorCode()

std::error_code wpi::errorToErrorCode ( Error  Err)

Helper for converting an ECError to a std::error_code.

This method requires that Err be Error() or an ECError, otherwise it will trigger a call to abort().

◆ errs()

raw_ostream& wpi::errs ( )

This returns a reference to a raw_ostream for standard error.

Use it like: errs() << "foo" << "bar";

◆ findFirstSet()

template<typename T >
T wpi::findFirstSet ( Val,
ZeroBehavior  ZB = ZB_Max 
)

Get the index of the first set bit starting from the least significant bit.

Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of 0. Only ZB_Max and ZB_Undefined are valid arguments.

◆ findLastSet()

template<typename T >
T wpi::findLastSet ( Val,
ZeroBehavior  ZB = ZB_Max 
)

Get the index of the last set bit starting from the least significant bit.

Only unsigned integral types are allowed.

Parameters
ZBthe behavior on an input of 0. Only ZB_Max and ZB_Undefined are valid arguments.

◆ FloatToBits()

uint32_t wpi::FloatToBits ( float  Float)
inline

This function takes a float and returns the bit equivalent 32-bit integer.

Note that copying floats around changes the bits of NaNs on some hosts, notably x86, so this routine cannot be used if these bits are needed.

◆ format()

template<typename... Ts>
format_object<Ts...> wpi::format ( const char *  Fmt,
const Ts &...  Vals 
)
inline

These are helper functions used to produce formatted output.

They use template type deduction to construct the appropriate instance of the format_object class to simplify their construction.

This is typically used like:

OS << format("%0.4f", myfloat) << '\n';

◆ format_decimal()

FormattedNumber wpi::format_decimal ( int64_t  N,
unsigned  Width 
)
inline

format_decimal - Output N as a right justified, fixed-width decimal.

If number will not fit in width, full number is still printed. Examples: OS << format_decimal(0, 5) => " 0" OS << format_decimal(255, 5) => " 255" OS << format_decimal(-1, 3) => " -1" OS << format_decimal(12345, 3) => "12345"

◆ format_hex()

FormattedNumber wpi::format_hex ( uint64_t  N,
unsigned  Width,
bool  Upper = false 
)
inline

format_hex - Output N as a fixed width hexadecimal.

If number will not fit in width, full number is still printed. Examples: OS << format_hex(255, 4) => 0xff OS << format_hex(255, 4, true) => 0xFF OS << format_hex(255, 6) => 0x00ff OS << format_hex(255, 2) => 0xff

◆ format_hex_no_prefix()

FormattedNumber wpi::format_hex_no_prefix ( uint64_t  N,
unsigned  Width,
bool  Upper = false 
)
inline

format_hex_no_prefix - Output N as a fixed width hexadecimal.

Does not prepend '0x' to the outputted string. If number will not fit in width, full number is still printed. Examples: OS << format_hex_no_prefix(255, 2) => ff OS << format_hex_no_prefix(255, 2, true) => FF OS << format_hex_no_prefix(255, 4) => 00ff OS << format_hex_no_prefix(255, 1) => ff

◆ fromHex()

std::string wpi::fromHex ( StringRef  Input)
inline

Convert hexadecimal string Input to its binary representation.

The return string is half the size of Input.

◆ GetStackTrace()

std::string wpi::GetStackTrace ( int  offset)

Get a stack trace, ignoring the first "offset" symbols.

Parameters
offsetThe number of symbols at the top of the stack to ignore

◆ getToken()

std::pair<StringRef, StringRef> wpi::getToken ( StringRef  Source,
StringRef  Delimiters = " \t\n\v\f\r" 
)

getToken - This function extracts one token from source, ignoring any leading characters that appear in the Delimiters string, and ending the token at any of the characters that appear in the Delimiters string.

If there are no tokens in the source string, an empty string is returned. The function returns a pair containing the extracted token and the remaining tail string.

◆ handleAllErrors() [1/2]

void wpi::handleAllErrors ( Error  E)
inline

Check that E is a non-error, then drop it.

If E is an error, wpi_unreachable will be called.

◆ handleAllErrors() [2/2]

template<typename... HandlerTs>
void wpi::handleAllErrors ( Error  E,
HandlerTs &&...  Handlers 
)

Behaves the same as handleErrors, except that by contract all errors must be handled by the given handlers (i.e.

there must be no remaining errors after running the handlers, or wpi_unreachable is called).

◆ handleErrors()

template<typename... HandlerTs>
Error wpi::handleErrors ( Error  E,
HandlerTs &&...  Hs 
)

Pass the ErrorInfo(s) contained in E to their respective handlers.

Any unhandled errors (or Errors returned by handlers) are re-concatenated and returned. Because this function returns an error, its result must also be checked or returned. If you intend to handle all errors use handleAllErrors (which returns void, and will abort() on unhandled errors) instead.

◆ handleExpected()

template<typename T , typename RecoveryFtor , typename... HandlerTs>
Expected<T> wpi::handleExpected ( Expected< T >  ValOrErr,
RecoveryFtor &&  RecoveryPath,
HandlerTs &&...  Handlers 
)

Handle any errors (if present) in an Expected<T>, then try a recovery path.

If the incoming value is a success value it is returned unmodified. If it is a failure value then it the contained error is passed to handleErrors. If handleErrors is able to handle the error then the RecoveryPath functor is called to supply the final result. If handleErrors is not able to handle all errors then the unhandled errors are returned.

This utility enables the follow pattern:

enum FooStrategy { Aggressive, Conservative };
Expected<Foo> foo(FooStrategy S);
auto ResultOrErr =
foo(Aggressive),
[]() { return foo(Conservative); },
[](AggressiveStrategyError&) {
// Implicitly conusme this - we'll recover by using a conservative
// strategy.
});

◆ hash_combine()

template<typename ... Ts>
hash_code wpi::hash_combine ( const Ts &...  args)

Combine values into a single hash_code.

This routine accepts a varying number of arguments of any type. It will attempt to combine them into a single hash_code. For user-defined types it attempts to call a

See also
hash_value overload (via ADL) for the type. For integer and pointer types it directly combines their data into the resulting hash_code.

The result is suitable for returning from a user's hash_value implementation for their user-defined type. Consumers of a type should not call this routine, they should instead call 'hash_value'.

◆ hash_combine_range()

template<typename InputIteratorT >
hash_code wpi::hash_combine_range ( InputIteratorT  first,
InputIteratorT  last 
)

Compute a hash_code for a sequence of values.

This hashes a sequence of values. It produces the same hash_code as 'hash_combine(a, b, c, ...)', but can run over arbitrary sized sequences and is significantly faster given pointers and types which can be hashed as a sequence of bytes.

◆ hash_value() [1/2]

template<typename T >
hash_code wpi::hash_value ( const T *  ptr)

Compute a hash_code for a pointer's address.

N.B.: This hashes the address. Not the value and not the type.

◆ hash_value() [2/2]

template<typename T >
std::enable_if< is_integral_or_enum< T >::value, hash_code >::type wpi::hash_value ( value)

Compute a hash_code for any integer value.

Note that this function is intended to compute the same hash_code for a particular value without regard to the pre-promotion type. This is in contrast to hash_combine which may produce different hash_codes for differing argument types even if they would implicit promote to a common type without changing the value.

◆ HashString()

static unsigned wpi::HashString ( StringRef  Str,
unsigned  Result = 0 
)
inlinestatic

HashString - Hash function for strings.

This is the Bernstein hash function.

◆ hasNItems()

template<typename IterTy >
bool wpi::hasNItems ( IterTy &&  Begin,
IterTy &&  End,
unsigned  N,
typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *  = nullptr 
)

Return true if the sequence [Begin, End) has exactly N items.

Runs in O(N) time. Not meant for use with random-access iterators.

◆ hasNItemsOrMore()

template<typename IterTy >
bool wpi::hasNItemsOrMore ( IterTy &&  Begin,
IterTy &&  End,
unsigned  N,
typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *  = nullptr 
)

Return true if the sequence [Begin, End) has N or more items.

Runs in O(N) time. Not meant for use with random-access iterators.

◆ hexDigitValue()

unsigned wpi::hexDigitValue ( char  C)
inline

Interpret the given character C as a hexadecimal digit and return its value.

If C is not a valid hex digit, -1U is returned.

◆ inconvertibleErrorCode()

std::error_code wpi::inconvertibleErrorCode ( )

The value returned by this function can be returned from convertToErrorCode for Error values where no sensible translation to std::error_code exists.

It should only be used in this situation, and should never be used where a sensible conversion to std::error_code is available, as attempts to convert to/from this error will result in a fatal error. (i.e. it is a programmatic error to try to convert such a value).

◆ install_bad_alloc_error_handler()

void wpi::install_bad_alloc_error_handler ( fatal_error_handler_t  handler,
void *  user_data = nullptr 
)

Installs a new bad alloc error handler that should be used whenever a bad alloc error, e.g.

failing malloc/calloc, is encountered by LLVM.

The user can install a bad alloc handler, in order to define the behavior in case of failing allocations, e.g. throwing an exception. Note that this handler must not trigger any additional allocations itself.

If no error handler is installed the default is to print the error message to stderr, and call exit(1). If an error handler is installed then it is the handler's responsibility to log the message, it will no longer be printed to stderr. If the error handler returns, then exit(1) will be called.

Parameters
user_data- An argument which will be passed to the installed error handler.

◆ install_fatal_error_handler()

void wpi::install_fatal_error_handler ( fatal_error_handler_t  handler,
void *  user_data = nullptr 
)

install_fatal_error_handler - Installs a new error handler to be used whenever a serious (non-recoverable) error is encountered by LLVM.

If no error handler is installed the default is to print the error message to stderr, and call exit(1). If an error handler is installed then it is the handler's responsibility to log the message, it will no longer be printed to stderr. If the error handler returns, then exit(1) will be called.

It is dangerous to naively use an error handler which throws an exception. Even though some applications desire to gracefully recover from arbitrary faults, blindly throwing exceptions through unfamiliar code isn't a way to achieve this.

Parameters
user_data- An argument which will be passed to the install error handler.

◆ isMask_32()

constexpr bool wpi::isMask_32 ( uint32_t  Value)
inlineconstexpr

Return true if the argument is a non-empty sequence of ones starting at the least significant bit with the remainder zero (32 bit version).

Ex. isMask_32(0x0000FFFFU) == true.

◆ isPowerOf2_32()

constexpr bool wpi::isPowerOf2_32 ( uint32_t  Value)
inlineconstexpr

Return true if the argument is a power of two > 0.

Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)

◆ isPrint()

bool wpi::isPrint ( char  C)
inline

Checks whether character C is printable.

Locale-independent version of the C standard library isprint whose results may differ on different platforms.

◆ isShiftedMask_32()

constexpr bool wpi::isShiftedMask_32 ( uint32_t  Value)
inlineconstexpr

Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit version.) Ex.

isShiftedMask_32(0x0000FF00U) == true.

◆ isUInt()

template<unsigned N>
constexpr std::enable_if<(N < 64), bool>::type wpi::isUInt ( uint64_t  X)
inlineconstexpr

Checks if an unsigned integer fits into the given bit width.

This is written as two functions rather than as simply

return N >= 64 || X < (UINT64_C(1) << N);

to keep MSVC from (incorrectly) warning on isUInt<64> that we're shifting left too many places.

◆ join_items()

template<typename Sep , typename... Args>
std::string wpi::join_items ( Sep  Separator,
Args &&...  Items 
)
inline

Joins the strings in the parameter pack Items, adding Separator between the elements.

All arguments must be implicitly convertible to std::string, or there should be an overload of std::string::operator+=() that accepts the argument explicitly.

◆ joinErrors()

Error wpi::joinErrors ( Error  E1,
Error  E2 
)
inline

Concatenate errors.

The resulting Error is unchecked, and contains the ErrorInfo(s), if any, contained in E1, followed by the ErrorInfo(s), if any, contained in E2.

◆ left_justify()

FormattedString wpi::left_justify ( StringRef  Str,
unsigned  Width 
)
inline

left_justify - append spaces after string so total output is Width characters.

If Str is larger that Width, full string is written with no padding.

◆ Log2_32()

unsigned wpi::Log2_32 ( uint32_t  Value)
inline

Return the floor log base 2 of the specified value, -1 if the value is zero.

(32 bit edition.) Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2

◆ Log2_32_Ceil()

unsigned wpi::Log2_32_Ceil ( uint32_t  Value)
inline

Return the ceil log base 2 of the specified value, 32 if the value is zero.

(32 bit edition). Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3

◆ Log2_64()

unsigned wpi::Log2_64 ( uint64_t  Value)
inline

Return the floor log base 2 of the specified value, -1 if the value is zero.

(64 bit edition.)

◆ Log2_64_Ceil()

unsigned wpi::Log2_64_Ceil ( uint64_t  Value)
inline

Return the ceil log base 2 of the specified value, 64 if the value is zero.

(64 bit edition.)

◆ logAllUnhandledErrors()

void wpi::logAllUnhandledErrors ( Error  E,
raw_ostream OS,
Twine  ErrorBanner = {} 
)

Log all errors (if any) in E to OS.

If there are any errors, ErrorBanner will be printed before the first one is logged. A newline will be printed after each error.

This function is compatible with the helpers from Support/WithColor.h. You can pass any of them as the OS. Please consider using them instead of including 'error: ' in the ErrorBanner.

This is useful in the base level of your program to allow clean termination (allowing clean deallocation of resources, etc.), while reporting error information to the user.

◆ make_filter_range()

template<typename RangeT , typename PredicateT >
iterator_range<filter_iterator<detail::IterOfRange<RangeT>, PredicateT> > wpi::make_filter_range ( RangeT &&  Range,
PredicateT  Pred 
)

Convenience function that takes a range of elements and a predicate, and return a new filter_iterator range.

FIXME: Currently if RangeT && is a rvalue reference to a temporary, the lifetime of that temporary is not kept by the returned range object, and the temporary is going to be dropped on the floor after the make_iterator_range full expression that contains this function call.

◆ make_range()

template<class T >
iterator_range<T> wpi::make_range ( x,
y 
)

Convenience function for iterating over sub-ranges.

This provides a bit of syntactic sugar to make using sub-ranges in for loops a bit easier. Analogous to std::make_pair().

◆ maskLeadingOnes()

template<typename T >
T wpi::maskLeadingOnes ( unsigned  N)

Create a bitmask with the N left-most bits set to 1, and all other bits set to 0.

Only unsigned types are allowed.

◆ maskLeadingZeros()

template<typename T >
T wpi::maskLeadingZeros ( unsigned  N)

Create a bitmask with the N left-most bits set to 0, and all other bits set to 1.

Only unsigned types are allowed.

◆ maskTrailingOnes()

template<typename T >
T wpi::maskTrailingOnes ( unsigned  N)

Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.

Only unsigned types are allowed.

◆ maskTrailingZeros()

template<typename T >
T wpi::maskTrailingZeros ( unsigned  N)

Create a bitmask with the N right-most bits set to 0, and all other bits set to 1.

Only unsigned types are allowed.

◆ MinAlign()

constexpr uint64_t wpi::MinAlign ( uint64_t  A,
uint64_t  B 
)
inlineconstexpr

A and B are either alignments or offsets.

Return the minimum alignment that may be assumed after adding the two together.

◆ NextPowerOf2()

uint64_t wpi::NextPowerOf2 ( uint64_t  A)
inline

Returns the next power of two (in 64-bits) that is strictly greater than A.

Returns zero on overflow.

◆ OffsetToAlignment()

uint64_t wpi::OffsetToAlignment ( uint64_t  Value,
uint64_t  Align 
)
inline

Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Align.

Align must be non-zero.

◆ operator!=()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::operator!= ( const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &  LHS,
const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &  RHS 
)

Inequality comparison for DenseMap.

Equivalent to !(LHS == RHS). See operator== for performance notes.

◆ operator==()

template<typename DerivedT , typename KeyT , typename ValueT , typename KeyInfoT , typename BucketT >
bool wpi::operator== ( const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &  LHS,
const DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT > &  RHS 
)

Equality comparison for DenseMap.

Iterates over elements of LHS confirming that each (key, value) pair in LHS is also in RHS, and that no additional pairs are in RHS. Equivalent to N calls to RHS.find and N value comparisons. Amortized complexity is linear, worst case is O(N^2) (if every hash collides).

◆ outs()

raw_ostream& wpi::outs ( )

This returns a reference to a raw_ostream for standard output.

Use it like: outs() << "foo" << "bar";

◆ PowerOf2Ceil()

uint64_t wpi::PowerOf2Ceil ( uint64_t  A)
inline

Returns the power of two which is greater than or equal to the given value.

Essentially, it is a ceil operation across the domain of powers of two.

◆ PowerOf2Floor()

uint64_t wpi::PowerOf2Floor ( uint64_t  A)
inline

Returns the power of two which is less than or equal to the given value.

Essentially, it is a floor operation across the domain of powers of two.

◆ ReadUleb128() [1/2]

uint64_t wpi::ReadUleb128 ( const char *  addr,
uint64_t *  ret 
)

Read unsigned LEB128 data @addr: the address where the ULEB128 data is stored @ret: address to store the result.

Decode an unsigned LEB128 encoded datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return the number of bytes read.

◆ ReadUleb128() [2/2]

bool wpi::ReadUleb128 ( raw_istream is,
uint64_t *  ret 
)

Read unsigned LEB128 data from a stream @is: the input stream where the ULEB128 data is to be read from @ret: address to store the result.

Decode an unsigned LEB128 encoded datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return false on stream error, true on success.

◆ report_bad_alloc_error()

void wpi::report_bad_alloc_error ( const char *  Reason,
bool  GenCrashDiag = true 
)

Reports a bad alloc error, calling any user defined bad alloc error handler.

In contrast to the generic 'report_fatal_error' functions, this function is expected to return, e.g. the user defined error handler throws an exception.

Note: When throwing an exception in the bad alloc handler, make sure that the following unwind succeeds, e.g. do not trigger additional allocations in the unwind chain.

If no error handler is installed (default), then a bad_alloc exception is thrown, if LLVM is compiled with exception support, otherwise an assertion is called.

◆ report_fatal_error() [1/2]

LLVM_ATTRIBUTE_NORETURN void wpi::report_fatal_error ( const char *  reason,
bool  gen_crash_diag = true 
)

Reports a serious error, calling any installed error handler.

These functions are intended to be used for error conditions which are outside the control of the compiler (I/O errors, invalid user input, etc.)

If no error handler is installed the default is to print the message to standard error, followed by a newline. After the error handler is called this function will call exit(1), it does not return.

◆ report_fatal_error() [2/2]

LLVM_ATTRIBUTE_NORETURN void wpi::report_fatal_error ( Error  Err,
bool  gen_crash_diag = true 
)

Report a serious error, calling any installed error handler.

See ErrorHandling.h.

◆ right_justify()

FormattedString wpi::right_justify ( StringRef  Str,
unsigned  Width 
)
inline

right_justify - add spaces before string so total output is Width characters.

If Str is larger that Width, full string is written with no padding.

◆ SaturatingAdd()

template<typename T >
std::enable_if<std::is_unsigned<T>::value, T>::type wpi::SaturatingAdd ( X,
Y,
bool *  ResultOverflowed = nullptr 
)

Add two unsigned integers, X and Y, of type T.

Clamp the result to the maximum representable value of T on overflow. ResultOverflowed indicates if the result is larger than the maximum representable value of type T.

◆ SaturatingMultiply()

template<typename T >
std::enable_if<std::is_unsigned<T>::value, T>::type wpi::SaturatingMultiply ( X,
Y,
bool *  ResultOverflowed = nullptr 
)

Multiply two unsigned integers, X and Y, of type T.

Clamp the result to the maximum representable value of T on overflow. ResultOverflowed indicates if the result is larger than the maximum representable value of type T.

◆ SaturatingMultiplyAdd()

template<typename T >
std::enable_if<std::is_unsigned<T>::value, T>::type wpi::SaturatingMultiplyAdd ( X,
Y,
A,
bool *  ResultOverflowed = nullptr 
)

Multiply two unsigned integers, X and Y, and add the unsigned integer, A to the product.

Clamp the result to the maximum representable value of T on overflow. ResultOverflowed indicates if the result is larger than the maximum representable value of type T.

◆ set_fixed_execution_hash_seed()

void wpi::set_fixed_execution_hash_seed ( uint64_t  fixed_value)

Override the execution seed with a fixed value.

This hashing library uses a per-execution seed designed to change on each run with high probability in order to ensure that the hash codes are not attackable and to ensure that output which is intended to be stable does not rely on the particulars of the hash codes produced.

That said, there are use cases where it is important to be able to reproduce exactly a specific behavior. To that end, we provide a function which will forcibly set the seed to a fixed value. This must be done at the start of the program, before any hashes are computed. Also, it cannot be undone. This makes it thread-hostile and very hard to use outside of immediately on start of a simple program designed for reproducible behavior.

◆ SignExtend32() [1/2]

template<unsigned B>
constexpr int32_t wpi::SignExtend32 ( uint32_t  X)
inlineconstexpr

Sign-extend the number in the bottom B bits of X to a 32-bit integer.

Requires 0 < B <= 32.

◆ SignExtend32() [2/2]

int32_t wpi::SignExtend32 ( uint32_t  X,
unsigned  B 
)
inline

Sign-extend the number in the bottom B bits of X to a 32-bit integer.

Requires 0 < B < 32.

◆ SignExtend64() [1/2]

template<unsigned B>
constexpr int64_t wpi::SignExtend64 ( uint64_t  x)
inlineconstexpr

Sign-extend the number in the bottom B bits of X to a 64-bit integer.

Requires 0 < B < 64.

◆ SignExtend64() [2/2]

int64_t wpi::SignExtend64 ( uint64_t  X,
unsigned  B 
)
inline

Sign-extend the number in the bottom B bits of X to a 64-bit integer.

Requires 0 < B < 64.

◆ size()

template<typename R >
auto wpi::size ( R &&  Range,
typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *  = nullptr 
) -> decltype(std::distance(Range.begin(), Range.end()))

Get the size of a range.

This is a wrapper function around std::distance which is only enabled when the operation is O(1).

◆ SizeUleb128()

uint64_t wpi::SizeUleb128 ( uint64_t  val)

Get size of unsigned LEB128 data @val: value.

Determine the number of bytes required to encode an unsigned LEB128 datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return the number of bytes required.

◆ StrInStrNoCase()

StringRef::size_type wpi::StrInStrNoCase ( StringRef  s1,
StringRef  s2 
)

StrInStrNoCase - Portable version of strcasestr.

Locates the first occurrence of string 's1' in string 's2', ignoring case. Returns the offset of s2 in s1 or npos if s2 cannot be found.

◆ to_integer()

template<typename N >
bool wpi::to_integer ( StringRef  S,
N &  Num,
unsigned  Base = 0 
)

Convert the string S to an integer of the specified type using the radix Base.

If Base is 0, auto-detects the radix. Returns true if the number was successfully converted, false otherwise.

◆ to_vector()

template<unsigned Size, typename R >
SmallVector<typename std::remove_const<detail::ValueOfRange<R> >::type, Size> wpi::to_vector ( R &&  Range)

Given a range of type R, iterate the entire range and return a SmallVector with elements of the vector.

This is useful, for example, when you want to iterate a range and then sort the results.

◆ toHex()

std::string wpi::toHex ( StringRef  Input,
bool  LowerCase = false 
)
inline

Convert buffer Input to its hexadecimal representation.

The returned string is double the size of Input.

◆ toString()

std::string wpi::toString ( Error  E)
inline

Write all error messages (if any) in E to a string.

The newline character is used to separate error messages.

◆ wpi_unreachable_internal()

LLVM_ATTRIBUTE_NORETURN void wpi::wpi_unreachable_internal ( const char *  msg = nullptr,
const char *  file = nullptr,
unsigned  line = 0 
)

This function calls abort(), and prints the optional message to stderr.

Use the wpi_unreachable macro (that adds location info), instead of calling this function directly.

◆ WriteUleb128()

uint64_t wpi::WriteUleb128 ( SmallVectorImpl< char > &  dest,
uint64_t  val 
)

Write unsigned LEB128 data @addr: the address where the ULEB128 data is to be stored @val: value to be stored.

Encode an unsigned LEB128 encoded datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return the number of bytes written.

◆ zip_longest()

template<typename T , typename U , typename... Args>
detail::zip_longest_range<T, U, Args...> wpi::zip_longest ( T &&  t,
U &&  u,
Args &&...  args 
)

Iterate over two or more iterators at the same time.

Iteration continues until all iterators reach the end. The std::optional only contains a value if the iterator has not reached the end.

Variable Documentation

◆ BitReverseTable256

const unsigned char wpi::BitReverseTable256[256]
static
Initial value:
= {
#define R2(n)
#define R4(n)
#define R6(n)
R6(0), R6(2), R6(1), R6(3)
}

Macro compressed bit reversal table for 256 bits.

http://graphics.stanford.edu/~seander/bithacks.html#BitReverseTable

◆ nullopt

constexpr std::nullopt_t wpi::nullopt
inlineconstexpr
Initial value:
=
std::nullopt
wpi::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:132
wpi::handleExpected
Expected< T > handleExpected(Expected< T > ValOrErr, RecoveryFtor &&RecoveryPath, HandlerTs &&... Handlers)
Handle any errors (if present) in an Expected<T>, then try a recovery path.
Definition: Error.h:865
wpi::alignTo
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
Definition: MathExtras.h:676
wpi::cantFail
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:629