9#ifndef LLVM_CLANG_AST_INTERP_BOOLEAN_H
10#define LLVM_CLANG_AST_INTERP_BOOLEAN_H
15#include "llvm/ADT/APSInt.h"
16#include "llvm/Support/MathExtras.h"
17#include "llvm/Support/raw_ostream.h"
42 bool operator>(
unsigned RHS)
const {
return static_cast<unsigned>(
V) > RHS; }
49 template <
typename Ty,
typename = std::enable_if_t<std::is_
integral_v<Ty>>>
50 explicit operator Ty()
const {
55 return APSInt(
APInt(1,
static_cast<uint64_t
>(
V),
false),
true);
64 constexpr static unsigned bitWidth() {
return 1; }
70 constexpr static bool isSigned() {
return false; }
83 void print(llvm::raw_ostream &OS)
const { OS << (
V ?
"true" :
"false"); }
86 llvm::raw_string_ostream OS(NameStr);
95 if constexpr (std::is_integral<T>::value)
97 return Boolean(
static_cast<decltype(Boolean::V)
>(
Value) != 0);
100 template <
unsigned SrcBits,
bool SrcSign>
101 static std::enable_if_t<SrcBits != 0, Boolean>
122 llvm_unreachable(
"Cannot decrement booleans");
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Wrapper around boolean types.
Boolean operator-() const
static Boolean from(T Value, unsigned NumBits)
ComparisonCategoryResult compare(const Boolean &RHS) const
static Boolean max(unsigned NumBits)
bool operator!=(Boolean RHS) const
static Boolean min(unsigned NumBits)
Boolean operator-(const Boolean &Other) const
static bool inv(Boolean A, Boolean *R)
static bool decrement(Boolean A, Boolean *R)
bool operator>(unsigned RHS) const
APSInt toAPSInt(unsigned NumBits) const
Boolean toUnsigned() const
static constexpr unsigned bitWidth()
static constexpr bool isSigned()
std::string toDiagnosticString(const ASTContext &Ctx) const
bool operator<(Boolean RHS) const
APValue toAPValue(const ASTContext &) const
bool operator==(Boolean RHS) const
Boolean truncate(unsigned TruncBits) const
bool operator>(Boolean RHS) const
bool operator<=(Boolean RHS) const
static std::enable_if_t< SrcBits !=0, Boolean > from(Integral< SrcBits, SrcSign > Value)
Boolean operator!() const
static constexpr bool isNegative()
static bool mul(Boolean A, Boolean B, unsigned OpBits, Boolean *R)
unsigned countLeadingZeros() const
void print(llvm::raw_ostream &OS) const
static constexpr bool isPositive()
Boolean()
Zero-initializes a boolean.
static bool neg(Boolean A, Boolean *R)
static Boolean from(T Value)
static bool inRange(int64_t Value, unsigned NumBits)
bool operator>=(Boolean RHS) const
static bool increment(Boolean A, Boolean *R)
static bool sub(Boolean A, Boolean B, unsigned OpBits, Boolean *R)
static constexpr bool isMinusOne()
static bool add(Boolean A, Boolean B, unsigned OpBits, Boolean *R)
Boolean operator~() const
Wrapper around numeric types.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Boolean &B)
ComparisonCategoryResult Compare(const T &X, const T &Y)
Helper to compare two comparable types.
The JSON file list parser is used to communicate input to InstallAPI.
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
const FunctionProtoType * T
@ Other
Other implicit parameter.