clang  14.0.0git
Classes | Namespaces | Macros | Enumerations | Functions
PrimType.h File Reference
#include <climits>
#include <cstddef>
#include <cstdint>
#include "Boolean.h"
#include "Integral.h"
#include "Pointer.h"
Include dependency graph for PrimType.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  clang::interp::PrimConv< T >
 Mapping from primitive types to their representation. More...
 
struct  clang::interp::PrimConv< PT_Sint8 >
 
struct  clang::interp::PrimConv< PT_Uint8 >
 
struct  clang::interp::PrimConv< PT_Sint16 >
 
struct  clang::interp::PrimConv< PT_Uint16 >
 
struct  clang::interp::PrimConv< PT_Sint32 >
 
struct  clang::interp::PrimConv< PT_Uint32 >
 
struct  clang::interp::PrimConv< PT_Sint64 >
 
struct  clang::interp::PrimConv< PT_Uint64 >
 
struct  clang::interp::PrimConv< PT_Bool >
 
struct  clang::interp::PrimConv< PT_Ptr >
 

Namespaces

 clang
 
 clang::interp
 

Macros

#define TYPE_SWITCH_CASE(Name, B)   case Name: { using T = PrimConv<Name>::T; do {B;} while(0); break; }
 Helper macro to simplify type switches. More...
 
#define TYPE_SWITCH(Expr, B)
 
#define COMPOSITE_TYPE_SWITCH(Expr, B, D)
 
#define INT_TYPE_SWITCH(Expr, B)
 

Enumerations

enum  clang::interp::PrimType : unsigned {
  clang::interp::PT_Sint8, clang::interp::PT_Uint8, clang::interp::PT_Sint16, clang::interp::PT_Uint16,
  clang::interp::PT_Sint32, clang::interp::PT_Uint32, clang::interp::PT_Sint64, clang::interp::PT_Uint64,
  clang::interp::PT_Bool, clang::interp::PT_Ptr
}
 Enumeration of the primitive types of the VM. More...
 

Functions

size_t clang::interp::primSize (PrimType Type)
 Returns the size of a primitive type in bytes. More...
 
constexpr size_t clang::interp::align (size_t Size)
 Aligns a size to the pointer alignment. More...
 
bool clang::interp::isPrimitiveIntegral (PrimType Type)
 

Macro Definition Documentation

◆ COMPOSITE_TYPE_SWITCH

#define COMPOSITE_TYPE_SWITCH (   Expr,
  B,
 
)
Value:
switch (Expr) { \
TYPE_SWITCH_CASE(PT_Ptr, B) \
default: do { D; } while(0); break; \
}

Definition at line 98 of file PrimType.h.

◆ INT_TYPE_SWITCH

#define INT_TYPE_SWITCH (   Expr,
 
)
Value:
switch (Expr) { \
TYPE_SWITCH_CASE(PT_Sint8, B) \
TYPE_SWITCH_CASE(PT_Uint8, B) \
TYPE_SWITCH_CASE(PT_Sint16, B) \
TYPE_SWITCH_CASE(PT_Uint16, B) \
TYPE_SWITCH_CASE(PT_Sint32, B) \
TYPE_SWITCH_CASE(PT_Uint32, B) \
TYPE_SWITCH_CASE(PT_Sint64, B) \
TYPE_SWITCH_CASE(PT_Uint64, B) \
default: llvm_unreachable("not an integer"); \
}

Definition at line 103 of file PrimType.h.

◆ TYPE_SWITCH

#define TYPE_SWITCH (   Expr,
 
)
Value:
switch (Expr) { \
TYPE_SWITCH_CASE(PT_Sint8, B) \
TYPE_SWITCH_CASE(PT_Uint8, B) \
TYPE_SWITCH_CASE(PT_Sint16, B) \
TYPE_SWITCH_CASE(PT_Uint16, B) \
TYPE_SWITCH_CASE(PT_Sint32, B) \
TYPE_SWITCH_CASE(PT_Uint32, B) \
TYPE_SWITCH_CASE(PT_Sint64, B) \
TYPE_SWITCH_CASE(PT_Uint64, B) \
TYPE_SWITCH_CASE(PT_Bool, B) \
TYPE_SWITCH_CASE(PT_Ptr, B) \
}

Definition at line 85 of file PrimType.h.

◆ TYPE_SWITCH_CASE

#define TYPE_SWITCH_CASE (   Name,
 
)    case Name: { using T = PrimConv<Name>::T; do {B;} while(0); break; }

Helper macro to simplify type switches.

The macro implicitly exposes a type T in the scope of the inner block.

Definition at line 83 of file PrimType.h.

clang::interp::PT_Uint16
@ PT_Uint16
Definition: PrimType.h:31
clang::interp::PT_Sint16
@ PT_Sint16
Definition: PrimType.h:30
clang::interp::PT_Bool
@ PT_Bool
Definition: PrimType.h:36
clang::interp::PT_Uint32
@ PT_Uint32
Definition: PrimType.h:33
clang::interp::PT_Uint8
@ PT_Uint8
Definition: PrimType.h:29
clang::interp::PT_Sint32
@ PT_Sint32
Definition: PrimType.h:32
clang::interp::PT_Sint8
@ PT_Sint8
Definition: PrimType.h:28
clang::interp::PT_Uint64
@ PT_Uint64
Definition: PrimType.h:35
clang::interp::PT_Sint64
@ PT_Sint64
Definition: PrimType.h:34
clang::interp::PT_Ptr
@ PT_Ptr
Definition: PrimType.h:37