16#ifndef LLVM_CLANG_AST_INTERP_PRIMITIVES_H
17#define LLVM_CLANG_AST_INTERP_PRIMITIVES_H
48template <
typename T>
inline bool CheckAddUB(T A, T B, T &R) {
49 if constexpr (std::is_signed_v<T>) {
50 return llvm::AddOverflow<T>(A, B, R);
57template <
typename T>
inline bool CheckSubUB(T A, T B, T &R) {
58 if constexpr (std::is_signed_v<T>) {
59 return llvm::SubOverflow<T>(A, B, R);
66template <
typename T>
inline bool CheckMulUB(T A, T B, T &R) {
67 if constexpr (std::is_signed_v<T>) {
68 return llvm::MulOverflow<T>(A, B, R);
69 }
else if constexpr (
sizeof(T) <
sizeof(
int)) {
72 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.
@ 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)
The JSON file list parser is used to communicate input to InstallAPI.
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.