15#ifndef LLVM_CLANG_LIB_CODEGEN_EHSCOPESTACK_H
16#define LLVM_CLANG_LIB_CODEGEN_EHSCOPESTACK_H
19#include "llvm/ADT/STLExtras.h"
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/IR/BasicBlock.h"
22#include "llvm/IR/Instructions.h"
23#include "llvm/IR/Value.h"
67template <
class T,
bool mightBeInstruction =
68 std::is_base_of<llvm::Value, T>::value &&
69 !std::is_base_of<llvm::Constant, T>::value &&
70 !std::is_base_of<llvm::BasicBlock, T>::value>
127 return A.Size == B.Size;
130 return A.Size != B.Size;
143 virtual void anchor();
165 F_IsNormalCleanupKind = 0x2,
166 F_IsEHCleanupKind = 0x4,
167 F_HasExitSwitch = 0x8,
202 template <
class T,
class... As>
204 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
207 template <std::size_t... Is>
215 restore(CGF, std::index_sequence_for<As...>()).Emit(CGF, flags);
242 stable_iterator InnermostNormalCleanup;
245 stable_iterator InnermostEHScope;
269 char *allocate(
size_t Size);
270 void deallocate(
size_t Size);
276 : StartOfBuffer(nullptr), EndOfBuffer(nullptr), StartOfData(nullptr),
287 "Cleanup's alignment is too large.");
288 void *Buffer = pushCleanup(
Kind,
sizeof(
T));
289 Cleanup *Obj =
new (Buffer)
T(A...);
294 template <
class T,
class... As>
297 "Cleanup's alignment is too large.");
298 void *Buffer = pushCleanup(
Kind,
sizeof(
T));
299 Cleanup *Obj =
new (Buffer)
T(std::move(A));
316 template <
class T,
class... As>
319 "Cleanup's alignment is too large.");
320 void *Buffer = pushCleanup(
Kind,
sizeof(
T) + T::getExtraSize(N));
321 return new (Buffer)
T(N, A...);
325 void *Buffer = pushCleanup(
Kind, Size);
326 std::memcpy(Buffer,
Cleanup, Size);
359 bool empty()
const {
return StartOfData == EndOfBuffer; }
365 return InnermostNormalCleanup !=
stable_end();
371 return InnermostNormalCleanup;
376 return InnermostEHScope;