Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/clang/lib/CodeGen/EHScopeStack.h
Line
Count
Source (jump to first uncovered line)
1
//===-- EHScopeStack.h - Stack for cleanup IR generation --------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// These classes should be the minimum interface required for other parts of
10
// CodeGen to emit cleanups.  The implementation is in CGCleanup.cpp and other
11
// implemenentation details that are not widely needed are in CGCleanup.h.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CLANG_LIB_CODEGEN_EHSCOPESTACK_H
16
#define LLVM_CLANG_LIB_CODEGEN_EHSCOPESTACK_H
17
18
#include "clang/Basic/LLVM.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"
24
25
namespace clang {
26
namespace CodeGen {
27
28
class CodeGenFunction;
29
30
/// A branch fixup.  These are required when emitting a goto to a
31
/// label which hasn't been emitted yet.  The goto is optimistically
32
/// emitted as a branch to the basic block for the label, and (if it
33
/// occurs in a scope with non-trivial cleanups) a fixup is added to
34
/// the innermost cleanup.  When a (normal) cleanup is popped, any
35
/// unresolved fixups in that scope are threaded through the cleanup.
36
struct BranchFixup {
37
  /// The block containing the terminator which needs to be modified
38
  /// into a switch if this fixup is resolved into the current scope.
39
  /// If null, LatestBranch points directly to the destination.
40
  llvm::BasicBlock *OptimisticBranchBlock;
41
42
  /// The ultimate destination of the branch.
43
  ///
44
  /// This can be set to null to indicate that this fixup was
45
  /// successfully resolved.
46
  llvm::BasicBlock *Destination;
47
48
  /// The destination index value.
49
  unsigned DestinationIndex;
50
51
  /// The initial branch of the fixup.
52
  llvm::BranchInst *InitialBranch;
53
};
54
55
template <class T> struct InvariantValue {
56
  typedef T type;
57
  typedef T saved_type;
58
  static bool needsSaving(type value) { return false; }
59
0
  static saved_type save(CodeGenFunction &CGF, type value) { return value; }
Unexecuted instantiation: clang::CodeGen::InvariantValue<clang::QualType>::save(clang::CodeGen::CodeGenFunction&, clang::QualType)
Unexecuted instantiation: clang::CodeGen::InvariantValue<void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::save(clang::CodeGen::CodeGenFunction&, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType))
Unexecuted instantiation: clang::CodeGen::InvariantValue<bool>::save(clang::CodeGen::CodeGenFunction&, bool)
Unexecuted instantiation: clang::CodeGen::InvariantValue<clang::CharUnits>::save(clang::CodeGen::CodeGenFunction&, clang::CharUnits)
60
0
  static type restore(CodeGenFunction &CGF, saved_type value) { return value; }
Unexecuted instantiation: clang::CodeGen::InvariantValue<clang::QualType>::restore(clang::CodeGen::CodeGenFunction&, clang::QualType)
Unexecuted instantiation: clang::CodeGen::InvariantValue<void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::restore(clang::CodeGen::CodeGenFunction&, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType))
Unexecuted instantiation: clang::CodeGen::InvariantValue<bool>::restore(clang::CodeGen::CodeGenFunction&, bool)
Unexecuted instantiation: clang::CodeGen::InvariantValue<clang::CharUnits>::restore(clang::CodeGen::CodeGenFunction&, clang::CharUnits)
61
};
62
63
/// A metaprogramming class for ensuring that a value will dominate an
64
/// arbitrary position in a function.
65
template <class T> struct DominatingValue : InvariantValue<T> {};
66
67
template <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>
71
struct DominatingPointer;
72
template <class T> struct DominatingPointer<T,false> : InvariantValue<T*> {};
73
// template <class T> struct DominatingPointer<T,true> at end of file
74
75
template <class T> struct DominatingValue<T*> : DominatingPointer<T> {};
76
77
enum CleanupKind : unsigned {
78
  /// Denotes a cleanup that should run when a scope is exited using exceptional
79
  /// control flow (a throw statement leading to stack unwinding, ).
80
  EHCleanup = 0x1,
81
82
  /// Denotes a cleanup that should run when a scope is exited using normal
83
  /// control flow (falling off the end of the scope, return, goto, ...).
84
  NormalCleanup = 0x2,
85
86
  NormalAndEHCleanup = EHCleanup | NormalCleanup,
87
88
  LifetimeMarker = 0x8,
89
  NormalEHLifetimeMarker = LifetimeMarker | NormalAndEHCleanup,
90
};
91
92
/// A stack of scopes which respond to exceptions, including cleanups
93
/// and catch blocks.
94
class EHScopeStack {
95
public:
96
  /* Should switch to alignof(uint64_t) instead of 8, when EHCleanupScope can */
97
  enum { ScopeStackAlignment = 8 };
98
99
  /// A saved depth on the scope stack.  This is necessary because
100
  /// pushing scopes onto the stack invalidates iterators.
101
  class stable_iterator {
102
    friend class EHScopeStack;
103
104
    /// Offset from StartOfData to EndOfBuffer.
105
    ptrdiff_t Size;
106
107
0
    stable_iterator(ptrdiff_t Size) : Size(Size) {}
108
109
  public:
110
0
    static stable_iterator invalid() { return stable_iterator(-1); }
111
0
    stable_iterator() : Size(-1) {}
112
113
0
    bool isValid() const { return Size >= 0; }
114
115
    /// Returns true if this scope encloses I.
116
    /// Returns false if I is invalid.
117
    /// This scope must be valid.
118
0
    bool encloses(stable_iterator I) const { return Size <= I.Size; }
119
120
    /// Returns true if this scope strictly encloses I: that is,
121
    /// if it encloses I and is not I.
122
    /// Returns false is I is invalid.
123
    /// This scope must be valid.
124
0
    bool strictlyEncloses(stable_iterator I) const { return Size < I.Size; }
125
126
0
    friend bool operator==(stable_iterator A, stable_iterator B) {
127
0
      return A.Size == B.Size;
128
0
    }
129
0
    friend bool operator!=(stable_iterator A, stable_iterator B) {
130
0
      return A.Size != B.Size;
131
0
    }
132
  };
133
134
  /// Information for lazily generating a cleanup.  Subclasses must be
135
  /// POD-like: cleanups will not be destructed, and they will be
136
  /// allocated on the cleanup stack and freely copied and moved
137
  /// around.
138
  ///
139
  /// Cleanup implementations should generally be declared in an
140
  /// anonymous namespace.
141
  class Cleanup {
142
    // Anchor the construction vtable.
143
    virtual void anchor();
144
145
  protected:
146
    ~Cleanup() = default;
147
148
  public:
149
    Cleanup(const Cleanup &) = default;
150
0
    Cleanup(Cleanup &&) {}
151
152
    // The copy and move assignment operator is defined as deleted pending
153
    // further motivation.
154
    Cleanup &operator=(const Cleanup &) = delete;
155
    Cleanup &operator=(Cleanup &&) = delete;
156
157
0
    Cleanup() = default;
158
159
0
    virtual bool isRedundantBeforeReturn() { return false; }
160
161
    /// Generation flags.
162
    class Flags {
163
      enum {
164
        F_IsForEH = 0x1,
165
        F_IsNormalCleanupKind = 0x2,
166
        F_IsEHCleanupKind = 0x4,
167
        F_HasExitSwitch = 0x8,
168
      };
169
      unsigned flags = 0;
170
171
    public:
172
0
      Flags() = default;
173
174
      /// isForEH - true if the current emission is for an EH cleanup.
175
0
      bool isForEHCleanup() const { return flags & F_IsForEH; }
176
0
      bool isForNormalCleanup() const { return !isForEHCleanup(); }
177
0
      void setIsForEHCleanup() { flags |= F_IsForEH; }
178
179
0
      bool isNormalCleanupKind() const { return flags & F_IsNormalCleanupKind; }
180
0
      void setIsNormalCleanupKind() { flags |= F_IsNormalCleanupKind; }
181
182
      /// isEHCleanupKind - true if the cleanup was pushed as an EH
183
      /// cleanup.
184
0
      bool isEHCleanupKind() const { return flags & F_IsEHCleanupKind; }
185
0
      void setIsEHCleanupKind() { flags |= F_IsEHCleanupKind; }
186
187
0
      bool hasExitSwitch() const { return flags & F_HasExitSwitch; }
188
0
      void setHasExitSwitch() { flags |= F_HasExitSwitch; }
189
    };
190
191
    /// Emit the cleanup.  For normal cleanups, this is run in the
192
    /// same EH context as when the cleanup was pushed, i.e. the
193
    /// immediately-enclosing context of the cleanup scope.  For
194
    /// EH cleanups, this is run in a terminate context.
195
    ///
196
    // \param flags cleanup kind.
197
    virtual void Emit(CodeGenFunction &CGF, Flags flags) = 0;
198
  };
199
200
  /// ConditionalCleanup stores the saved form of its parameters,
201
  /// then restores them and performs the cleanup.
202
  template <class T, class... As>
203
  class ConditionalCleanup final : public Cleanup {
204
    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
205
    SavedTuple Saved;
206
207
    template <std::size_t... Is>
208
0
    T restore(CodeGenFunction &CGF, std::index_sequence<Is...>) {
209
      // It's important that the restores are emitted in order. The braced init
210
      // list guarantees that.
211
0
      return T{DominatingValue<As>::restore(CGF, std::get<Is>(Saved))...};
212
0
    }
Unexecuted instantiation: CGCall.cpp:(anonymous namespace)::DestroyUnpassedArg clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyUnpassedArg, clang::CodeGen::Address, clang::QualType>::restore<0ul, 1ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Unexecuted instantiation: clang::CodeGen::CodeGenFunction::CallLifetimeEnd clang::CodeGen::EHScopeStack::ConditionalCleanup<clang::CodeGen::CodeGenFunction::CallLifetimeEnd, clang::CodeGen::Address, llvm::Value*>::restore<0ul, 1ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Unexecuted instantiation: CGDecl.cpp:(anonymous namespace)::DestroyObject clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>::restore<0ul, 1ul, 2ul, 3ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
Unexecuted instantiation: CGDecl.cpp:(anonymous namespace)::IrregularPartialArrayDestroy clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::IrregularPartialArrayDestroy, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::restore<0ul, 1ul, 2ul, 3ul, 4ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul>)
Unexecuted instantiation: CGDecl.cpp:(anonymous namespace)::RegularPartialArrayDestroy clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::RegularPartialArrayDestroy, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::restore<0ul, 1ul, 2ul, 3ul, 4ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul>)
Unexecuted instantiation: CGException.cpp:(anonymous namespace)::FreeException clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::FreeException, llvm::Value*>::restore<0ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul>)
Unexecuted instantiation: CGObjC.cpp:(anonymous namespace)::CallObjCRelease clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCRelease, llvm::Value*>::restore<0ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul>)
Unexecuted instantiation: CGBuiltin.cpp:(anonymous namespace)::CallObjCArcUse clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCArcUse, llvm::Value*>::restore<0ul>(clang::CodeGen::CodeGenFunction&, std::__1::integer_sequence<unsigned long, 0ul>)
213
214
0
    void Emit(CodeGenFunction &CGF, Flags flags) override {
215
0
      restore(CGF, std::index_sequence_for<As...>()).Emit(CGF, flags);
216
0
    }
Unexecuted instantiation: CGCall.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyUnpassedArg, clang::CodeGen::Address, clang::QualType>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: clang::CodeGen::EHScopeStack::ConditionalCleanup<clang::CodeGen::CodeGenFunction::CallLifetimeEnd, clang::CodeGen::Address, llvm::Value*>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::IrregularPartialArrayDestroy, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::RegularPartialArrayDestroy, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGException.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::FreeException, llvm::Value*>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGObjC.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCRelease, llvm::Value*>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
Unexecuted instantiation: CGBuiltin.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCArcUse, llvm::Value*>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags)
217
218
  public:
219
    ConditionalCleanup(typename DominatingValue<As>::saved_type... A)
220
0
        : Saved(A...) {}
221
222
0
    ConditionalCleanup(SavedTuple Tuple) : Saved(std::move(Tuple)) {}
Unexecuted instantiation: CGCall.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyUnpassedArg, clang::CodeGen::Address, clang::QualType>::ConditionalCleanup(std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType>)
Unexecuted instantiation: clang::CodeGen::EHScopeStack::ConditionalCleanup<clang::CodeGen::CodeGenFunction::CallLifetimeEnd, clang::CodeGen::Address, llvm::Value*>::ConditionalCleanup(std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>::ConditionalCleanup(std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::IrregularPartialArrayDestroy, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::ConditionalCleanup(std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>)
Unexecuted instantiation: CGDecl.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::RegularPartialArrayDestroy, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>::ConditionalCleanup(std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>)
Unexecuted instantiation: CGException.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::FreeException, llvm::Value*>::ConditionalCleanup(std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
Unexecuted instantiation: CGObjC.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCRelease, llvm::Value*>::ConditionalCleanup(std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
Unexecuted instantiation: CGBuiltin.cpp:clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCArcUse, llvm::Value*>::ConditionalCleanup(std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
223
  };
224
225
private:
226
  // The implementation for this class is in CGException.h and
227
  // CGException.cpp; the definition is here because it's used as a
228
  // member of CodeGenFunction.
229
230
  /// The start of the scope-stack buffer, i.e. the allocated pointer
231
  /// for the buffer.  All of these pointers are either simultaneously
232
  /// null or simultaneously valid.
233
  char *StartOfBuffer;
234
235
  /// The end of the buffer.
236
  char *EndOfBuffer;
237
238
  /// The first valid entry in the buffer.
239
  char *StartOfData;
240
241
  /// The innermost normal cleanup on the stack.
242
  stable_iterator InnermostNormalCleanup;
243
244
  /// The innermost EH scope on the stack.
245
  stable_iterator InnermostEHScope;
246
247
  /// The CGF this Stack belong to
248
  CodeGenFunction* CGF;
249
250
  /// The current set of branch fixups.  A branch fixup is a jump to
251
  /// an as-yet unemitted label, i.e. a label for which we don't yet
252
  /// know the EH stack depth.  Whenever we pop a cleanup, we have
253
  /// to thread all the current branch fixups through it.
254
  ///
255
  /// Fixups are recorded as the Use of the respective branch or
256
  /// switch statement.  The use points to the final destination.
257
  /// When popping out of a cleanup, these uses are threaded through
258
  /// the cleanup and adjusted to point to the new cleanup.
259
  ///
260
  /// Note that branches are allowed to jump into protected scopes
261
  /// in certain situations;  e.g. the following code is legal:
262
  ///     struct A { ~A(); }; // trivial ctor, non-trivial dtor
263
  ///     goto foo;
264
  ///     A a;
265
  ///    foo:
266
  ///     bar();
267
  SmallVector<BranchFixup, 8> BranchFixups;
268
269
  char *allocate(size_t Size);
270
  void deallocate(size_t Size);
271
272
  void *pushCleanup(CleanupKind K, size_t DataSize);
273
274
public:
275
  EHScopeStack()
276
    : StartOfBuffer(nullptr), EndOfBuffer(nullptr), StartOfData(nullptr),
277
      InnermostNormalCleanup(stable_end()), InnermostEHScope(stable_end()),
278
0
      CGF(nullptr) {}
279
0
  ~EHScopeStack() { delete[] StartOfBuffer; }
280
281
  EHScopeStack(const EHScopeStack &) = delete;
282
  EHScopeStack &operator=(const EHScopeStack &) = delete;
283
284
  /// Push a lazily-created cleanup on the stack.
285
0
  template <class T, class... As> void pushCleanup(CleanupKind Kind, As... A) {
286
0
    static_assert(alignof(T) <= ScopeStackAlignment,
287
0
                  "Cleanup's alignment is too large.");
288
0
    void *Buffer = pushCleanup(Kind, sizeof(T));
289
0
    Cleanup *Obj = new (Buffer) T(A...);
290
0
    (void) Obj;
291
0
  }
Unexecuted instantiation: CGCall.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CopyBackSwiftError, clang::CodeGen::Address, clang::CodeGen::Address>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, clang::CodeGen::Address)
Unexecuted instantiation: CGCall.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyUnpassedArg, clang::CodeGen::Address, clang::QualType>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, clang::QualType)
Unexecuted instantiation: void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::CodeGenFunction::CallLifetimeEnd, clang::CodeGen::Address, llvm::Value*>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, llvm::Value*)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallBaseDtor, clang::CXXRecordDecl const*, bool>(clang::CodeGen::CleanupKind, clang::CXXRecordDecl const*, bool)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::SanitizeDtorFieldRange, clang::CXXDestructorDecl const*, unsigned int, unsigned int>(clang::CodeGen::CleanupKind, clang::CXXDestructorDecl const*, unsigned int, unsigned int)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::SanitizeDtorFieldRange, clang::CXXDestructorDecl const*, unsigned int, int>(clang::CodeGen::CleanupKind, clang::CXXDestructorDecl const*, unsigned int, int)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallDtorDeleteConditional, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::Value*)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallDtorDelete>(clang::CodeGen::CleanupKind)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::SanitizeDtorVTable, clang::CXXDestructorDecl const*>(clang::CodeGen::CleanupKind, clang::CXXDestructorDecl const*)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::SanitizeDtorTrivialBase, clang::CXXRecordDecl*, bool>(clang::CodeGen::CleanupKind, clang::CXXRecordDecl*, bool)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallBaseDtor, clang::CXXRecordDecl*, bool>(clang::CodeGen::CleanupKind, clang::CXXRecordDecl*, bool)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyField, clang::FieldDecl const*, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), unsigned int>(clang::CodeGen::CleanupKind, clang::FieldDecl const*, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), unsigned int)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallDelegatingCtorDtor, clang::CXXDestructorDecl*, clang::CodeGen::Address, clang::CXXDtorType>(clang::CodeGen::CleanupKind, clang::CXXDestructorDecl*, clang::CodeGen::Address, clang::CXXDtorType)
Unexecuted instantiation: CGClass.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallLocalDtor, clang::CXXDestructorDecl const*, clang::CodeGen::Address, clang::QualType>(clang::CodeGen::CleanupKind, clang::CXXDestructorDecl const*, clang::CodeGen::Address, clang::QualType)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyNRVOVariableCXX, clang::CodeGen::Address, clang::QualType, clang::CXXDestructorDecl*, llvm::Value*>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, clang::QualType, clang::CXXDestructorDecl*, llvm::Value*)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyNRVOVariableC, clang::CodeGen::Address, llvm::Value*, clang::QualType>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, llvm::Value*, clang::QualType)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::ExtendGCLifetime, clang::VarDecl const*>(clang::CodeGen::CleanupKind, clang::VarDecl const*)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallCleanupFunction, llvm::Constant*, clang::CodeGen::CGFunctionInfo const*, clang::VarDecl const*>(clang::CodeGen::CleanupKind, llvm::Constant*, clang::CodeGen::CGFunctionInfo const*, clang::VarDecl const*)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallStackRestore, clang::CodeGen::Address>(clang::CodeGen::CleanupKind, clang::CodeGen::Address)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::KmpcAllocFree, std::__1::pair<llvm::Value*, llvm::Value*> >(clang::CodeGen::CleanupKind, std::__1::pair<llvm::Value*, llvm::Value*>)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>(clang::CodeGen::CleanupKind, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::IrregularPartialArrayDestroy, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>(clang::CodeGen::CleanupKind, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType))
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::RegularPartialArrayDestroy, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>(clang::CodeGen::CleanupKind, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType))
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::ConsumeARCParameter, llvm::Value*, clang::CodeGen::ARCPreciseLifetime_t>(clang::CodeGen::CleanupKind, llvm::Value*, clang::CodeGen::ARCPreciseLifetime_t)
Unexecuted instantiation: CGException.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::FreeException, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::Value*)
Unexecuted instantiation: CGException.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::PerformFinally, clang::Stmt const*, llvm::AllocaInst*, llvm::FunctionCallee, llvm::FunctionCallee, llvm::AllocaInst*>(clang::CodeGen::CleanupKind, clang::Stmt const*, llvm::AllocaInst*, llvm::FunctionCallee, llvm::FunctionCallee, llvm::AllocaInst*)
Unexecuted instantiation: CGException.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallEndCatchForFinally, llvm::Value*, llvm::FunctionCallee>(clang::CodeGen::CleanupKind, llvm::Value*, llvm::FunctionCallee)
Unexecuted instantiation: CGException.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::PerformSEHFinally, llvm::Function*>(clang::CodeGen::CleanupKind, llvm::Function*)
Unexecuted instantiation: CGExprCXX.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallArrayDelete, llvm::Value*, clang::FunctionDecl const*, llvm::Value*, clang::QualType, clang::CharUnits>(clang::CodeGen::CleanupKind, llvm::Value*, clang::FunctionDecl const*, llvm::Value*, clang::QualType, clang::CharUnits)
Unexecuted instantiation: CGExprCXX.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallObjectDelete, llvm::Value*, clang::FunctionDecl const*, clang::QualType>(clang::CodeGen::CleanupKind, llvm::Value*, clang::FunctionDecl const*, clang::QualType)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DestroyIvar, llvm::Value*, clang::ObjCIvarDecl const*, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), unsigned int>(clang::CodeGen::CleanupKind, llvm::Value*, clang::ObjCIvarDecl const*, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), unsigned int)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::FinishARCDealloc>(clang::CodeGen::CleanupKind)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallObjCRelease, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::Value*)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallObjCAutoreleasePoolObject, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::Value*)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallObjCMRRAutoreleasePoolObject, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::Value*)
Unexecuted instantiation: void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::CatchRetScope, llvm::CatchPadInst*>(clang::CodeGen::CleanupKind, llvm::CatchPadInst*)
Unexecuted instantiation: CGObjCRuntime.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallObjCEndCatch, bool, llvm::FunctionCallee>(clang::CodeGen::CleanupKind, bool, llvm::FunctionCallee)
Unexecuted instantiation: CGObjCRuntime.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallSyncExit, llvm::FunctionCallee, llvm::Value*>(clang::CodeGen::CleanupKind, llvm::FunctionCallee, llvm::Value*)
Unexecuted instantiation: CGOpenMPRuntime.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CleanupTy, clang::CodeGen::PrePostActionTy*>(clang::CodeGen::CleanupKind, clang::CodeGen::PrePostActionTy*)
Unexecuted instantiation: CGOpenMPRuntime.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::DoacrossCleanupTy, llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*> >(clang::CodeGen::CleanupKind, llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>)
Unexecuted instantiation: CGOpenMPRuntime.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::CGOpenMPRuntime::getAddressOfLocalVariable(clang::CodeGen::CodeGenFunction&, clang::VarDecl const*)::OMPAllocateCleanupTy, llvm::FunctionCallee, unsigned int, clang::CodeGen::Address, clang::Expr const*>(clang::CodeGen::CleanupKind, llvm::FunctionCallee, unsigned int, clang::CodeGen::Address, clang::Expr const*)
Unexecuted instantiation: void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::OMPAllocateCleanupTy, llvm::CallInst*>(clang::CodeGen::CleanupKind, llvm::CallInst*)
Unexecuted instantiation: ItaniumCXXABI.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallEndCatch, bool>(clang::CodeGen::CleanupKind, bool)
Unexecuted instantiation: ItaniumCXXABI.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallGuardAbort, llvm::GlobalVariable*>(clang::CodeGen::CleanupKind, llvm::GlobalVariable*)
Unexecuted instantiation: MicrosoftCXXABI.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::ResetGuardBit, clang::CodeGen::ConstantAddress, unsigned int>(clang::CodeGen::CleanupKind, clang::CodeGen::ConstantAddress, unsigned int)
Unexecuted instantiation: MicrosoftCXXABI.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallInitThreadAbort, clang::CodeGen::ConstantAddress>(clang::CodeGen::CleanupKind, clang::CodeGen::ConstantAddress)
Unexecuted instantiation: CGBlocks.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallBlockRelease, clang::CodeGen::Address, clang::CodeGen::BlockFieldFlags, bool, bool>(clang::CodeGen::CleanupKind, clang::CodeGen::Address, clang::CodeGen::BlockFieldFlags, bool, bool)
Unexecuted instantiation: CGCoroutine.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallCoroDelete, clang::Expr*>(clang::CodeGen::CleanupKind, clang::Expr*)
Unexecuted instantiation: CGCoroutine.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::CallCoroEnd>(clang::CodeGen::CleanupKind)
Unexecuted instantiation: CGObjCMac.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<(anonymous namespace)::PerformFragileFinally, clang::Stmt const*, clang::CodeGen::Address, clang::CodeGen::Address, clang::CodeGen::Address, (anonymous namespace)::ObjCTypesHelper*>(clang::CodeGen::CleanupKind, clang::Stmt const*, clang::CodeGen::Address, clang::CodeGen::Address, clang::CodeGen::Address, (anonymous namespace)::ObjCTypesHelper*)
Unexecuted instantiation: CGOpenMPRuntimeGPU.cpp:void clang::CodeGen::EHScopeStack::pushCleanup<clang::CodeGen::CGOpenMPRuntimeGPU::emitFunctionProlog(clang::CodeGen::CodeGenFunction&, clang::Decl const*)::GlobalizationScope>(clang::CodeGen::CleanupKind)
292
293
  /// Push a lazily-created cleanup on the stack. Tuple version.
294
  template <class T, class... As>
295
0
  void pushCleanupTuple(CleanupKind Kind, std::tuple<As...> A) {
296
0
    static_assert(alignof(T) <= ScopeStackAlignment,
297
0
                  "Cleanup's alignment is too large.");
298
0
    void *Buffer = pushCleanup(Kind, sizeof(T));
299
0
    Cleanup *Obj = new (Buffer) T(std::move(A));
300
0
    (void) Obj;
301
0
  }
Unexecuted instantiation: CGCall.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyUnpassedArg, clang::CodeGen::Address, clang::QualType>, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType>(clang::CodeGen::CleanupKind, std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType>)
Unexecuted instantiation: void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<clang::CodeGen::CodeGenFunction::CallLifetimeEnd, clang::CodeGen::Address, llvm::Value*>, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >(clang::CodeGen::CleanupKind, std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>(clang::CodeGen::CleanupKind, std::__1::tuple<clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::IrregularPartialArrayDestroy, llvm::Value*, clang::CodeGen::Address, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>(clang::CodeGen::CleanupKind, std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::CodeGen::DominatingValue<clang::CodeGen::Address>::saved_type, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>)
Unexecuted instantiation: CGDecl.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::RegularPartialArrayDestroy, llvm::Value*, llvm::Value*, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>(clang::CodeGen::CleanupKind, std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > >, clang::QualType, clang::CharUnits, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType)>)
Unexecuted instantiation: CGException.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::FreeException, llvm::Value*>, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >(clang::CodeGen::CleanupKind, std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
Unexecuted instantiation: CGObjC.cpp:void clang::CodeGen::EHScopeStack::pushCleanupTuple<clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::CallObjCRelease, llvm::Value*>, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >(clang::CodeGen::CleanupKind, std::__1::tuple<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*> > > >)
302
303
  // Feel free to add more variants of the following:
304
305
  /// Push a cleanup with non-constant storage requirements on the
306
  /// stack.  The cleanup type must provide an additional static method:
307
  ///   static size_t getExtraSize(size_t);
308
  /// The argument to this method will be the value N, which will also
309
  /// be passed as the first argument to the constructor.
310
  ///
311
  /// The data stored in the extra storage must obey the same
312
  /// restrictions as normal cleanup member data.
313
  ///
314
  /// The pointer returned from this method is valid until the cleanup
315
  /// stack is modified.
316
  template <class T, class... As>
317
0
  T *pushCleanupWithExtra(CleanupKind Kind, size_t N, As... A) {
318
0
    static_assert(alignof(T) <= ScopeStackAlignment,
319
0
                  "Cleanup's alignment is too large.");
320
0
    void *Buffer = pushCleanup(Kind, sizeof(T) + T::getExtraSize(N));
321
0
    return new (Buffer) T(N, A...);
322
0
  }
Unexecuted instantiation: CGExprCXX.cpp:(anonymous namespace)::CallDeleteDuringNew<EnterNewDeleteCleanup(clang::CodeGen::CodeGenFunction&, clang::CXXNewExpr const*, clang::CodeGen::Address, llvm::Value*, clang::CharUnits, clang::CodeGen::CallArgList const&)::DirectCleanupTraits>* clang::CodeGen::EHScopeStack::pushCleanupWithExtra<(anonymous namespace)::CallDeleteDuringNew<EnterNewDeleteCleanup(clang::CodeGen::CodeGenFunction&, clang::CXXNewExpr const*, clang::CodeGen::Address, llvm::Value*, clang::CharUnits, clang::CodeGen::CallArgList const&)::DirectCleanupTraits>, clang::FunctionDecl*, llvm::Value*, llvm::Value*, bool, clang::CharUnits>(clang::CodeGen::CleanupKind, unsigned long, clang::FunctionDecl*, llvm::Value*, llvm::Value*, bool, clang::CharUnits)
Unexecuted instantiation: CGExprCXX.cpp:(anonymous namespace)::CallDeleteDuringNew<EnterNewDeleteCleanup(clang::CodeGen::CodeGenFunction&, clang::CXXNewExpr const*, clang::CodeGen::Address, llvm::Value*, clang::CharUnits, clang::CodeGen::CallArgList const&)::ConditionalCleanupTraits>* clang::CodeGen::EHScopeStack::pushCleanupWithExtra<(anonymous namespace)::CallDeleteDuringNew<EnterNewDeleteCleanup(clang::CodeGen::CodeGenFunction&, clang::CXXNewExpr const*, clang::CodeGen::Address, llvm::Value*, clang::CharUnits, clang::CodeGen::CallArgList const&)::ConditionalCleanupTraits>, clang::FunctionDecl*, clang::CodeGen::DominatingValue<clang::CodeGen::RValue>::saved_type, clang::CodeGen::DominatingValue<clang::CodeGen::RValue>::saved_type, bool, clang::CharUnits>(clang::CodeGen::CleanupKind, unsigned long, clang::FunctionDecl*, clang::CodeGen::DominatingValue<clang::CodeGen::RValue>::saved_type, clang::CodeGen::DominatingValue<clang::CodeGen::RValue>::saved_type, bool, clang::CharUnits)
323
324
0
  void pushCopyOfCleanup(CleanupKind Kind, const void *Cleanup, size_t Size) {
325
0
    void *Buffer = pushCleanup(Kind, Size);
326
0
    std::memcpy(Buffer, Cleanup, Size);
327
0
  }
328
329
0
  void setCGF(CodeGenFunction *inCGF) { CGF = inCGF; }
330
331
  /// Pops a cleanup scope off the stack.  This is private to CGCleanup.cpp.
332
  void popCleanup();
333
334
  /// Push a set of catch handlers on the stack.  The catch is
335
  /// uninitialized and will need to have the given number of handlers
336
  /// set on it.
337
  class EHCatchScope *pushCatch(unsigned NumHandlers);
338
339
  /// Pops a catch scope off the stack.  This is private to CGException.cpp.
340
  void popCatch();
341
342
  /// Push an exceptions filter on the stack.
343
  class EHFilterScope *pushFilter(unsigned NumFilters);
344
345
  /// Pops an exceptions filter off the stack.
346
  void popFilter();
347
348
  /// Push a terminate handler on the stack.
349
  void pushTerminate();
350
351
  /// Pops a terminate handler off the stack.
352
  void popTerminate();
353
354
  // Returns true iff the current scope is either empty or contains only
355
  // lifetime markers, i.e. no real cleanup code
356
  bool containsOnlyLifetimeMarkers(stable_iterator Old) const;
357
358
  /// Determines whether the exception-scopes stack is empty.
359
0
  bool empty() const { return StartOfData == EndOfBuffer; }
360
361
  bool requiresLandingPad() const;
362
363
  /// Determines whether there are any normal cleanups on the stack.
364
0
  bool hasNormalCleanups() const {
365
0
    return InnermostNormalCleanup != stable_end();
366
0
  }
367
368
  /// Returns the innermost normal cleanup on the stack, or
369
  /// stable_end() if there are no normal cleanups.
370
0
  stable_iterator getInnermostNormalCleanup() const {
371
0
    return InnermostNormalCleanup;
372
0
  }
373
  stable_iterator getInnermostActiveNormalCleanup() const;
374
375
0
  stable_iterator getInnermostEHScope() const {
376
0
    return InnermostEHScope;
377
0
  }
378
379
380
  /// An unstable reference to a scope-stack depth.  Invalidated by
381
  /// pushes but not pops.
382
  class iterator;
383
384
  /// Returns an iterator pointing to the innermost EH scope.
385
  iterator begin() const;
386
387
  /// Returns an iterator pointing to the outermost EH scope.
388
  iterator end() const;
389
390
  /// Create a stable reference to the top of the EH stack.  The
391
  /// returned reference is valid until that scope is popped off the
392
  /// stack.
393
0
  stable_iterator stable_begin() const {
394
0
    return stable_iterator(EndOfBuffer - StartOfData);
395
0
  }
396
397
  /// Create a stable reference to the bottom of the EH stack.
398
0
  static stable_iterator stable_end() {
399
0
    return stable_iterator(0);
400
0
  }
401
402
  /// Translates an iterator into a stable_iterator.
403
  stable_iterator stabilize(iterator it) const;
404
405
  /// Turn a stable reference to a scope depth into a unstable pointer
406
  /// to the EH stack.
407
  iterator find(stable_iterator save) const;
408
409
  /// Add a branch fixup to the current cleanup scope.
410
0
  BranchFixup &addBranchFixup() {
411
0
    assert(hasNormalCleanups() && "adding fixup in scope without cleanups");
412
0
    BranchFixups.push_back(BranchFixup());
413
0
    return BranchFixups.back();
414
0
  }
415
416
0
  unsigned getNumBranchFixups() const { return BranchFixups.size(); }
417
0
  BranchFixup &getBranchFixup(unsigned I) {
418
0
    assert(I < getNumBranchFixups());
419
0
    return BranchFixups[I];
420
0
  }
421
422
  /// Pops lazily-removed fixups from the end of the list.  This
423
  /// should only be called by procedures which have just popped a
424
  /// cleanup or resolved one or more fixups.
425
  void popNullFixups();
426
427
  /// Clears the branch-fixups list.  This should only be called by
428
  /// ResolveAllBranchFixups.
429
0
  void clearFixups() { BranchFixups.clear(); }
430
};
431
432
} // namespace CodeGen
433
} // namespace clang
434
435
#endif