13#ifndef LLVM_CLANG_AST_INTERP_BLOCK_H
14#define LLVM_CLANG_AST_INTERP_BLOCK_H
21#include "llvm/ADT/PointerUnion.h"
22#include "llvm/Support/raw_ostream.h"
52 Block(
unsigned EvalID,
const std::optional<unsigned> &DeclID,
53 const Descriptor *Desc,
bool IsStatic =
false,
bool IsExtern =
false,
55 : EvalID(EvalID), DeclID(DeclID), IsStatic(IsStatic), IsExtern(IsExtern),
56 IsDynamic(
false), IsWeak(IsWeak), Desc(Desc) {
61 bool IsExtern =
false,
bool IsWeak =
false)
62 : EvalID(EvalID), DeclID((
unsigned)-1), IsStatic(IsStatic),
63 IsExtern(IsExtern), IsDynamic(
false), IsWeak(IsWeak), Desc(Desc) {
77 bool isWeak()
const {
return IsWeak; }
82 std::optional<unsigned>
getDeclID()
const {
return DeclID; }
96 const std::byte *
data()
const {
105 return reinterpret_cast<std::byte *
>(
this) +
sizeof(
Block);
108 return reinterpret_cast<const std::byte *
>(
this) +
sizeof(
Block);
113 assert(!IsInitialized);
119 IsInitialized =
true;
124 assert(IsInitialized);
127 IsInitialized =
false;
131 void dump(llvm::raw_ostream &OS)
const;
140 bool IsWeak,
bool IsDead)
142 IsDynamic(
false), IsWeak(IsWeak), Desc(Desc) {
154 bool hasPointer(
const Pointer *
P)
const;
157 const unsigned EvalID = ~0u;
161 std::optional<unsigned> DeclID;
165 bool IsExtern =
false;
171 bool IsInitialized =
false;
174 bool IsDynamic =
false;
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
A memory block, either on the stack or in the heap.
unsigned getSize() const
Returns the size of the block.
Block(unsigned EvalID, const std::optional< unsigned > &DeclID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false, bool IsWeak=false)
Creates a new block.
void invokeDtor()
Invokes the Destructor.
Block(unsigned EvalID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false, bool IsWeak=false)
bool isExtern() const
Checks if the block is extern.
std::byte * data()
Returns a pointer to the stored data.
const Descriptor * getDescriptor() const
Returns the block's descriptor.
const std::byte * rawData() const
void invokeCtor()
Invokes the constructor.
bool isStatic() const
Checks if the block has static storage duration.
bool isTemporary() const
Checks if the block is temporary.
std::byte * rawData()
Returns a pointer to the raw data, including metadata.
const std::byte * data() const
bool isInitialized() const
Returns whether the data of this block has been initialized via invoking the Ctor func.
unsigned getEvalID() const
The Evaluation ID this block was created in.
std::optional< unsigned > getDeclID() const
Returns the declaration ID.
bool hasPointers() const
Checks if the block has any live pointers.
Descriptor for a dead block.
std::byte * data()
Returns a pointer to the stored data.
Manages dynamic memory allocations done during bytecode interpretation.
A pointer to a memory block, live or dead.
PrimType
Enumeration of the primitive types of the VM.
The JSON file list parser is used to communicate input to InstallAPI.
Describes a memory block created by an allocation site.
const bool IsConst
Flag indicating if the block is mutable.
unsigned getAllocSize() const
Returns the allocated size, including metadata.
const BlockCtorFn CtorFn
Storage management methods.
unsigned getMetadataSize() const
Returns the size of the metadata.
const bool IsMutable
Flag indicating if a field is mutable.
const bool IsTemporary
Flag indicating if the block is a temporary.