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)
54 : EvalID(EvalID), DeclID(DeclID), IsStatic(IsStatic), IsExtern(IsExtern),
55 IsDynamic(
false), Desc(Desc) {
60 bool IsExtern =
false)
61 : EvalID(EvalID), DeclID((
unsigned)-1), IsStatic(IsStatic),
62 IsExtern(IsExtern), IsDynamic(
false), Desc(Desc) {
80 std::optional<unsigned>
getDeclID()
const {
return DeclID; }
94 const std::byte *
data()
const {
103 return reinterpret_cast<std::byte *
>(
this) +
sizeof(
Block);
106 return reinterpret_cast<const std::byte *
>(
this) +
sizeof(
Block);
111 assert(!IsInitialized);
117 IsInitialized =
true;
122 assert(IsInitialized);
125 IsInitialized =
false;
129 void dump(llvm::raw_ostream &OS)
const;
140 IsDynamic(
false), Desc(Desc) {
152 bool hasPointer(
const Pointer *
P)
const;
155 const unsigned EvalID = ~0u;
159 std::optional<unsigned> DeclID;
163 bool IsExtern =
false;
169 bool IsInitialized =
false;
172 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.
void invokeDtor()
Invokes the Destructor.
bool isExtern() const
Checks if the block is extern.
std::byte * data()
Returns a pointer to the stored data.
Block(unsigned EvalID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false)
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.
Block(unsigned EvalID, const std::optional< unsigned > &DeclID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false)
Creates a new block.
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.