18#ifndef CLANG_LIB_CIR_CODEGEN_EHSCOPESTACK_H
19#define CLANG_LIB_CIR_CODEGEN_EHSCOPESTACK_H
21#include "llvm/ADT/SmallVector.h"
65 bool isValid()
const {
return size >= 0; }
79 return A.size == B.size;
82 return A.size != B.size;
95 virtual void anchor();
124 std::unique_ptr<char[]> startOfBuffer;
127 char *endOfBuffer =
nullptr;
130 char *startOfData =
nullptr;
139 char *allocate(
size_t size);
140 void deallocate(
size_t size);
142 void *pushCleanup(
CleanupKind kind,
size_t dataSize);
151 "Cleanup's alignment is too large.");
152 void *buffer = pushCleanup(kind,
sizeof(
T));
153 [[maybe_unused]]
Cleanup *obj =
new (buffer)
T(a...);
162 bool empty()
const {
return startOfData == endOfBuffer; }
169 iterator
begin()
const;
__PTRDIFF_TYPE__ ptrdiff_t
Information for lazily generating a cleanup.
Cleanup(const Cleanup &)=default
virtual size_t getSize() const =0
virtual ~Cleanup()=default
virtual void emit(CIRGenFunction &cgf)=0
Emit the cleanup.
A saved depth on the scope stack.
bool strictlyEncloses(stable_iterator I) const
Returns true if this scope strictly encloses I: that is, if it encloses I and is not I.
bool encloses(stable_iterator other) const
Returns true if this scope encloses I.
friend bool operator==(stable_iterator A, stable_iterator B)
friend bool operator!=(stable_iterator A, stable_iterator B)
static stable_iterator invalid()
stable_iterator()=default
A stack of scopes which respond to exceptions, including cleanups and catch blocks.
void setCGF(CIRGenFunction *inCGF)
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
void popCleanup()
Pops a cleanup scope off the stack. This is private to CIRGenCleanup.cpp.
void pushCleanup(CleanupKind kind, As... a)
Push a lazily-created cleanup on the stack.
bool empty() const
Determines whether the exception-scopes stack is empty.
static stable_iterator stable_end()
Create a stable reference to the bottom of the EH stack.
iterator begin() const
Returns an iterator pointing to the innermost EH scope.
@ EHCleanup
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
@ NormalCleanup
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
const FunctionProtoType * T