llvm/clang/lib/AST/ByteCode/PrimType.h

//===--- PrimType.h - Types for the constexpr VM ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Defines the VM types and helpers operating on types.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_INTERP_TYPE_H
#define LLVM_CLANG_AST_INTERP_TYPE_H

#include "llvm/Support/raw_ostream.h"
#include <climits>
#include <cstddef>
#include <cstdint>

namespace clang {
namespace interp {

class Pointer;
class Boolean;
class Floating;
class FunctionPointer;
class MemberPointer;
class FixedPoint;
template <bool Signed> class IntegralAP;
template <unsigned Bits, bool Signed> class Integral;

/// Enumeration of the primitive types of the VM.
enum PrimType : unsigned {};

inline constexpr bool isPtrType(PrimType T) {}

enum class CastKind : uint8_t {};
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
                                     interp::CastKind CK) {}

constexpr bool isIntegralType(PrimType T) {}

/// Mapping from primitive types to their representation.
template <PrimType T> struct PrimConv;
template <> struct PrimConv<PT_Sint8> {};
template <> struct PrimConv<PT_Uint8> {};
template <> struct PrimConv<PT_Sint16> {};
template <> struct PrimConv<PT_Uint16> {};
template <> struct PrimConv<PT_Sint32> {};
template <> struct PrimConv<PT_Uint32> {};
template <> struct PrimConv<PT_Sint64> {};
template <> struct PrimConv<PT_Uint64> {};
template <> struct PrimConv<PT_IntAP> {};
template <> struct PrimConv<PT_IntAPS> {};
template <> struct PrimConv<PT_Float> {};
template <> struct PrimConv<PT_Bool> {};
template <> struct PrimConv<PT_Ptr> {};
template <> struct PrimConv<PT_FnPtr> {};
template <> struct PrimConv<PT_MemberPtr> {};
template <> struct PrimConv<PT_FixedPoint> {};

/// Returns the size of a primitive type in bytes.
size_t primSize(PrimType Type);

/// Aligns a size to the pointer alignment.
constexpr size_t align(size_t Size) {}

constexpr bool aligned(uintptr_t Value) {}
static_assert;

static inline bool aligned(const void *P) {}

} // namespace interp
} // namespace clang

/// Helper macro to simplify type switches.
/// The macro implicitly exposes a type T in the scope of the inner block.
#define TYPE_SWITCH_CASE(Name, B)
#define TYPE_SWITCH(Expr, B)

#define INT_TYPE_SWITCH(Expr, B)

#define INT_TYPE_SWITCH_NO_BOOL(Expr, B)

#define COMPOSITE_TYPE_SWITCH(Expr, B, D)
#endif