WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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
 Helper for building an aligned character array type. More...
 
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  bad_optional_access
 
class  buffer_ostream
 
struct  build_index_impl
 
struct  build_index_impl< 0, I...>
 
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 >
 
struct  constexpr_optional_base
 
union  constexpr_storage_t
 
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< int >
 
struct  DenseMapInfo< long >
 
struct  DenseMapInfo< long long >
 
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...
 
struct  equal
 A functor like C++14's std::equal<void> in its absence. More...
 
class  ErrorOr
 Represents either an error or a value T. More...
 
class  EventLoopRunner
 Executes an event loop on a separate thread. 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
 
singleton  function_ref
 An efficient, type-erasing, non-owning reference to a callable. More...
 
class  function_ref< Ret(Params...)>
 
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
 
struct  in_place_t
 
struct  index_sequence
 Alias for the common case of a sequence of size_ts. More...
 
struct  index_sequence_for
 Creates a compile-time integer sequence for a parameter pack. More...
 
struct  integer_sequence
 Represents a compile-time sequence of integers. More...
 
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< 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
 A functor like C++14's std::less<void> in its absence. More...
 
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
 
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  nullopt_t
 
class  optional
 
class  optional< T & >
 
class  optional< T && >
 
struct  optional_base
 
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
 
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< T * >
 
struct  PointerLikeTypeTraits< uintptr_t >
 
struct  PointerLikeTypeTraits< void * >
 
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...
 
class  ReferenceStorage
 Stores a reference that can be changed. 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
 
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  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...
 
class  SmallVectorBase
 This is all the non-templated stuff common to all SmallVectors. More...
 
singleton  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 which aren't contained in SmallVectorTemplateCommon. More...
 
struct  SmallVectorStorage< T, 0 >
 
struct  SmallVectorStorage< T, 1 >
 
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...
 
union  storage_t
 
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...
 
struct  trivial_init_t
 
class  Twine
 Twine - A lightweight data structure for efficiently representing the concatenation of temporary values as strings. More...
 
class  UDPClient
 
class  UidVector
 
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  WebSocket
 RFC 6455 compliant WebSocket client and server implementation. More...
 
class  WebSocketServer
 Dedicated WebSocket server. More...
 
class  WebSocketServerHelper
 WebSocket HTTP server helper. More...
 
singleton  WorkerThread
 
class  WorkerThread< R(T...)>
 

Typedefs

template<class T >
using OptionalBase = typename std::conditional< std::is_trivially_destructible< T >::value, constexpr_optional_base< typename std::remove_const< T >::type >, optional_base< typename std::remove_const< T >::type > >::type
 
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. More...
 
using recursive_spinlock = recursive_spinlock1
 
typedef int(* http_data_cb )(http_parser *, const char *at, size_t length)
 
typedef int(* http_cb )(http_parser *)
 
typedef unsigned int UTF32
 
typedef unsigned short UTF16
 
typedef unsigned char UTF8
 
typedef bool Boolean
 
using mutex = ::std::mutex
 
using recursive_mutex = ::std::recursive_mutex
 
using condition_variable = ::std::condition_variable
 

Enumerations

enum  ZeroBehavior { ZB_Undefined, ZB_Max, ZB_Width }
 The behavior an operation has on an input of 0. More...
 
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
}
 
enum  ConversionResult { conversionOK, sourceExhausted, targetExhausted, sourceIllegal }
 
enum  ConversionFlags { strictConversion = 0, lenientConversion }
 
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
}
 

Functions

int SocketErrno ()
 
std::string SocketStrerror (int code)
 
std::string GetHostname ()
 
StringRef GetHostname (SmallVectorImpl< char > &name)
 
char hexdigit (unsigned X, bool LowerCase=false)
 hexdigit - Return the hexadecimal character for the given number X (which should be less than 16). More...
 
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. 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)
 Convert buffer Input to its hexadecimal representation. More...
 
std::string toHex (ArrayRef< uint8_t > Input)
 
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. More...
 
StringRef getOrdinalSuffix (unsigned Val)
 Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th).
 
void PrintEscapedString (StringRef Name, raw_ostream &Out)
 PrintEscapedString - Print each character of the specified string, escaping it if it is not printable or if it is an escape char. More...
 
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. More...
 
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. More...
 
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<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). More...
 
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. More...
 
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. More...
 
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...
 
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, optional< size_t > Width=nullopt)
 
void write_double (raw_ostream &S, double D, FloatStyle Style, optional< size_t > Precision=nullopt)
 
template<class T >
constexpr T && constexpr_forward (typename std::remove_reference< T >::type &t) noexcept
 
template<class T >
constexpr T && constexpr_forward (typename std::remove_reference< T >::type &&t) noexcept
 
template<class T >
constexpr
std::remove_reference< T >
::type && 
constexpr_move (T &&t) noexcept
 
template<class T >
constexpr bool operator== (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator!= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator< (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator> (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator<= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator>= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool operator== (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool operator== (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool operator!= (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool operator!= (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool operator< (const optional< T > &, nullopt_t) noexcept
 
template<class T >
constexpr bool operator< (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool operator<= (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool operator<= (nullopt_t, const optional< T > &) noexcept
 
template<class T >
constexpr bool operator> (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool operator> (nullopt_t, const optional< T > &) noexcept
 
template<class T >
constexpr bool operator>= (const optional< T > &, nullopt_t) noexcept
 
template<class T >
constexpr bool operator>= (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool operator== (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator== (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator!= (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator!= (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator< (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator> (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator> (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator< (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator>= (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator<= (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator<= (const optional< T > &x, const T &v)
 
template<class T >
constexpr bool operator>= (const T &v, const optional< T > &x)
 
template<class T >
constexpr bool operator== (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator== (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator!= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator!= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator< (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator> (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator> (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator< (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator>= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator<= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator<= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool operator>= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool operator== (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator== (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool operator!= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator!= (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool operator< (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator> (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool operator> (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator< (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool operator>= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator<= (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool operator<= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool operator>= (const T &v, const optional< const T & > &x)
 
template<class T >
void swap (optional< T > &x, optional< T > &y) noexcept(noexcept(x.swap(y)))
 
template<class T >
constexpr optional< typename
std::decay< T >::type > 
make_optional (T &&v)
 
template<class X >
constexpr optional< X & > make_optional (std::reference_wrapper< X > v)
 
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<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<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<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. More...
 
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. 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. More...
 
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. 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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 >
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<class T , class... Args>
std::enable_if<!std::is_array
< T >::value, std::unique_ptr
< T > >::type 
make_unique (Args &&...args)
 Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object. More...
 
template<class T >
std::enable_if< std::is_array
< T >::value &&std::extent< T >
::value==0, std::unique_ptr< T >
>::type 
make_unique (size_t n)
 Constructs a new T[n] with the given args and returns a unique_ptr<T[]> which owns the object. More...
 
template<class T , class... Args>
std::enable_if< std::extent< T >
::value!=0 >::type 
make_unique (Args &&...)=delete
 This function isn't used and is only here to provide better compile errors.
 
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 F , typename Tuple >
auto apply_tuple (F &&f, Tuple &&t) -> decltype(detail::apply_tuple_impl(std::forward< F >(f), std::forward< Tuple >(t), build_index_impl< std::tuple_size< typename std::decay< Tuple >::type >::value >
 Given an input tuple (a1, a2, ..., an), pass the arguments of the tuple variadically to f as if by calling f(a1, a2, ..., an) and return the result. More...
 
uint64_t SizeUleb128 (uint64_t val)
 Get size of unsigned LEB128 data : value. More...
 
uint64_t WriteUleb128 (SmallVectorImpl< char > &dest, uint64_t val)
 Write unsigned LEB128 data : the address where the ULEB128 data is to be stored : value to be stored. More...
 
uint64_t ReadUleb128 (const char *addr, uint64_t *ret)
 Read unsigned LEB128 data : the address where the ULEB128 data is stored : address to store the result. More...
 
bool ReadUleb128 (raw_istream &is, uint64_t *ret)
 Read unsigned LEB128 data from a stream : the input stream where the ULEB128 data is to be read from : address to store the result. More...
 
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)
 
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 T , unsigned N>
size_t capacity_in_bytes (const SmallVector< T, N > &X)
 
template<typename T >
hash_code hash_value (ArrayRef< T > S)
 
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<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 (size_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...
 
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.
 
void * CheckedCalloc (size_t num, size_t size)
 Wrapper around std::calloc that calls std::terminate on out of memory. More...
 
void * CheckedMalloc (size_t size)
 Wrapper around std::malloc that calls std::terminate on out of memory. More...
 
void * CheckedRealloc (void *ptr, size_t size)
 Wrapper around std::realloc that calls std::terminate on out of memory. More...
 
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)
 
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...
 
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...
 
std::error_code mapWindowsError (unsigned EV)
 
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)
 
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(begin(std::declval
< T >)))> 
drop_begin (T &&t, int n)
 
template<typename KeyT , typename ValueT , typename KeyInfoT >
size_t capacity_in_bytes (const DenseMap< KeyT, ValueT, KeyInfoT > &X)
 
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.
 
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.
 
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, optional< uint64_t > FirstByteOffset=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, optional< uint64_t > FirstByteOffset=nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
 
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(). More...
 
Twine operator+ (const StringRef &LHS, const char *RHS)
 Additional overload to guarantee simplified codegen; this is equivalent to concat(). More...
 
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)
 
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)
 

Variables

constexpr struct
wpi::trivial_init_t 
trivial_init
 
constexpr struct wpi::in_place_t in_place
 
constexpr nullopt_t nullopt {nullopt_t::init()}
 
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. More...
 

Detailed Description

WPILib C++ utilities (wpiutil) namespace.

Typedef Documentation

template<typename WrappedIteratorT , typename PredicateT >
using wpi::filter_iterator = typedef 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.

Enumeration Type Documentation

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

template<typename T >
std::enable_if<std::is_unsigned<T>::value, T>::type wpi::AbsoluteDifference ( X,
Y 
)

Subtract two unsigned integers, X and Y, of type T and return the absolute value of the result.

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.

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

size_t wpi::alignmentAdjustment ( const void *  Ptr,
size_t  Alignment 
)
inline

Returns the necessary adjustment for aligning Ptr to Alignment bytes, rounding up.

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
template<uint64_t Align>
constexpr uint64_t wpi::alignTo ( uint64_t  Value)
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.

template<typename R , typename UnaryPredicate >
bool wpi::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 wpi::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 F , typename Tuple >
auto wpi::apply_tuple ( F &&  f,
Tuple &&  t 
) -> decltype(detail::apply_tuple_impl( std::forward<F>(f), std::forward<Tuple>(t), build_index_impl< std::tuple_size<typename std::decay<Tuple>::type>::value>

Given an input tuple (a1, a2, ..., an), pass the arguments of the tuple variadically to f as if by calling f(a1, a2, ..., an) and return the result.

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.

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.

void* wpi::CheckedCalloc ( size_t  num,
size_t  size 
)

Wrapper around std::calloc that calls std::terminate on out of memory.

Parameters
numnumber of objects to allocate
sizenumber of bytes per object to allocate
Returns
Pointer to beginning of newly allocated memory.
void* wpi::CheckedMalloc ( size_t  size)

Wrapper around std::malloc that calls std::terminate on out of memory.

Parameters
sizenumber of bytes to allocate
Returns
Pointer to beginning of newly allocated memory.
void* wpi::CheckedRealloc ( void *  ptr,
size_t  size 
)

Wrapper around std::realloc that calls std::terminate on out of memory.

Parameters
ptrmemory previously allocated
sizenumber of bytes to allocate
Returns
Pointer to beginning of newly allocated memory.
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.

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.
bool wpi::convertUTF16ToUTF8String ( ArrayRef< UTF16 >  SrcUTF16,
SmallVectorImpl< char > &  DstUTF8 
)

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

Returns
true on success
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
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.

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.

template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt wpi::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 E >
auto wpi::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 wpi::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 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.
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.
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.

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.
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.
template<typename Container >
void wpi::DeleteContainerPointers ( Container &  C)

For a container of pointers, deletes the pointers and then clears the container.

template<typename Container >
void wpi::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.

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.

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

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.

raw_ostream& wpi::errs ( )

This returns a reference to a raw_ostream for standard error.

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

template<typename R , typename T >
auto wpi::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 wpi::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 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.
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.
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.

template<typename R , typename UnaryPredicate >
UnaryPredicate wpi::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... 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';
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"

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

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

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

Convert hexadecimal string Input to its binary representation.

The return string is half the size of Input.

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.

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'.

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.

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.

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.

char wpi::hexdigit ( unsigned  X,
bool  LowerCase = false 
)
inline

hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).

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.

template<typename R , typename E >
bool wpi::is_contained ( R &&  Range,
const E &  Element 
)

Wrapper function around std::find to detect if an element exists in a container.

bool wpi::isAlnum ( char  C)
inline

Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classified by "C" locale.

constexpr bool wpi::isMask_32 ( uint32_t  Value)
inline

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.

constexpr bool wpi::isMask_64 ( uint64_t  Value)
inline

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 wpi::isPowerOf2_32 ( uint32_t  Value)
inline

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

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

constexpr bool wpi::isShiftedMask_32 ( uint32_t  Value)
inline

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

isShiftedMask_32(0x0000FF00U) == true.

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

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.

template<typename IteratorT >
std::string wpi::join ( IteratorT  Begin,
IteratorT  End,
StringRef  Separator 
)
inline

Joins the strings in the range [Begin, End), adding Separator between the elements.

template<typename Range >
std::string wpi::join ( Range &&  R,
StringRef  Separator 
)
inline

Joins the strings in the range [R.begin(), R.end()), adding Separator between the elements.

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.

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.

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

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

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.)

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.)

template<typename R , typename ForwardIt >
auto wpi::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 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.

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().

template<class T , class... Args>
std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type wpi::make_unique ( Args &&...  args)

Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object.

Example:

auto p = make_unique<int>();
auto p = make_unique<std::tuple<int, int>>(0, 1);  
template<class T >
std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0, std::unique_ptr<T> >::type wpi::make_unique ( size_t  n)

Constructs a new T[n] with the given args and returns a unique_ptr<T[]> which owns the object.

Parameters
nsize of the new array.

Example:

auto p = make_unique<int[]>(2); // value-initializes the array with 0's.  
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.

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.

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.

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.

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

A and B are either alignments or offsets.

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

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.

template<typename R , typename UnaryPredicate >
bool wpi::none_of ( R &&  Range,
UnaryPredicate  P 
)

Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.

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.

Twine wpi::operator+ ( const char *  LHS,
const StringRef &  RHS 
)
inline

Additional overload to guarantee simplified codegen; this is equivalent to concat().

Twine wpi::operator+ ( const StringRef &  LHS,
const char *  RHS 
)
inline

Additional overload to guarantee simplified codegen; this is equivalent to concat().

raw_ostream& wpi::outs ( )

This returns a reference to a raw_ostream for standard output.

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

template<typename R , typename UnaryPredicate >
auto wpi::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.

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.

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.

void wpi::PrintEscapedString ( StringRef  Name,
raw_ostream &  Out 
)

PrintEscapedString - Print each character of the specified string, escaping it if it is not printable or if it is an escape char.

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

Read unsigned LEB128 data : the address where the ULEB128 data is stored : 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.

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

Read unsigned LEB128 data from a stream : the input stream where the ULEB128 data is to be read from : 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.

template<typename R , typename UnaryPredicate >
auto wpi::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.

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.

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.

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.

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.

void wpi::set_fixed_execution_hash_seed ( size_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.

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

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

Requires 0 < B <= 32.

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.

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

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

Requires 0 < B < 64.

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.

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).

uint64_t wpi::SizeUleb128 ( uint64_t  val)

Get size of unsigned LEB128 data : 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.

void wpi::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.

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.

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.

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.

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

Convert buffer Input to its hexadecimal representation.

The returned string is double the size of Input.

template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt wpi::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.

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

Write unsigned LEB128 data : the address where the ULEB128 data is to be stored : 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.

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

zip iterator that, for the sake of efficiency, assumes the first iteratee to be the shortest.

Variable Documentation

template<typename T >
int(*)(const void*, const void*) wpi::get_array_pod_sort_comparator(const T &)
inline

get_array_pod_sort_comparator - This is an internal helper function used to get type deduction of T right.