16#ifndef LLVM_CLANG_AST_INTERP_PRIMITIVES_H
17#define LLVM_CLANG_AST_INTERP_PRIMITIVES_H
50template <
typename T>
inline bool CheckAddUB(T A, T B, T &R) {
51 if constexpr (std::is_signed_v<T>) {
52 return llvm::AddOverflow<T>(A, B, R);
59template <
typename T>
inline bool CheckSubUB(T A, T B, T &R) {
60 if constexpr (std::is_signed_v<T>) {
61 return llvm::SubOverflow<T>(A, B, R);
68template <
typename T>
inline bool CheckMulUB(T A, T B, T &R) {
69 if constexpr (std::is_signed_v<T>) {
70 return llvm::MulOverflow<T>(A, B, R);
71 }
else if constexpr (
sizeof(T) <
sizeof(
int)) {
74 R =
static_cast<T
>(
static_cast<unsigned>(A) *
static_cast<unsigned>(B));
bool CheckMulUB(T A, T B, T &R)
@ BlockAddress
A pointer to an interp::Block.
@ AddrLabelDiff
Difference between two AddrLabelExpr.
@ Number
Just a number, nothing else.
@ ExprAddress
A pointer to an Expr.
@ Address
A pointer to a ValueDecl.
@ LabelAddress
A pointer to a AddrLabelExpr.
@ FunctionAddress
A pointer to a FunctionDecl.
ComparisonCategoryResult Compare(const T &X, const T &Y)
Helper to compare two comparable types.
bool CheckSubUB(T A, T B, T &R)
bool CheckAddUB(T A, T B, T &R)
Top level wrappers for InstallAPI frontend operations.
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
int32_t uint32_t uint32_t __builtin_riscv_mhracc_i32 __builtin_riscv_mhraccu_u32 __builtin_riscv_mhraccsu_i32 __builtin_riscv_mhacc_h1_i32 __builtin_riscv_mhaccsu_h1_i32 __builtin_riscv_mulqr_i32 __builtin_riscv_mqrwacc_i64 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t