Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/CrashRecoveryContext.h
Line
Count
Source (jump to first uncovered line)
1
//===--- CrashRecoveryContext.h - Crash Recovery ----------------*- 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
#ifndef LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H
10
#define LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H
11
12
#include "llvm/ADT/STLExtras.h"
13
14
namespace llvm {
15
class CrashRecoveryContextCleanup;
16
17
/// Crash recovery helper object.
18
///
19
/// This class implements support for running operations in a safe context so
20
/// that crashes (memory errors, stack overflow, assertion violations) can be
21
/// detected and control restored to the crashing thread. Crash detection is
22
/// purely "best effort", the exact set of failures which can be recovered from
23
/// is platform dependent.
24
///
25
/// Clients make use of this code by first calling
26
/// CrashRecoveryContext::Enable(), and then executing unsafe operations via a
27
/// CrashRecoveryContext object. For example:
28
///
29
/// \code
30
///    void actual_work(void *);
31
///
32
///    void foo() {
33
///      CrashRecoveryContext CRC;
34
///
35
///      if (!CRC.RunSafely(actual_work, 0)) {
36
///         ... a crash was detected, report error to user ...
37
///      }
38
///
39
///      ... no crash was detected ...
40
///    }
41
/// \endcode
42
///
43
/// To assist recovery the class allows specifying set of actions that will be
44
/// executed in any case, whether crash occurs or not. These actions may be used
45
/// to reclaim resources in the case of crash.
46
class CrashRecoveryContext {
47
  void *Impl;
48
  CrashRecoveryContextCleanup *head;
49
50
public:
51
3.89k
  CrashRecoveryContext() : Impl(nullptr), head(nullptr) {}
52
  ~CrashRecoveryContext();
53
54
  /// Register cleanup handler, which is used when the recovery context is
55
  /// finished.
56
  /// The recovery context owns the handler.
57
  void registerCleanup(CrashRecoveryContextCleanup *cleanup);
58
59
  void unregisterCleanup(CrashRecoveryContextCleanup *cleanup);
60
61
  /// Enable crash recovery.
62
  static void Enable();
63
64
  /// Disable crash recovery.
65
  static void Disable();
66
67
  /// Return the active context, if the code is currently executing in a
68
  /// thread which is in a protected context.
69
  static CrashRecoveryContext *GetCurrent();
70
71
  /// Return true if the current thread is recovering from a crash.
72
  static bool isRecoveringFromCrash();
73
74
  /// Execute the provided callback function (with the given arguments) in
75
  /// a protected context.
76
  ///
77
  /// \return True if the function completed successfully, and false if the
78
  /// function crashed (or HandleCrash was called explicitly). Clients should
79
  /// make as little assumptions as possible about the program state when
80
  /// RunSafely has returned false.
81
  bool RunSafely(function_ref<void()> Fn);
82
0
  bool RunSafely(void (*Fn)(void*), void *UserData) {
83
0
    return RunSafely([&]() { Fn(UserData); });
84
0
  }
85
86
  /// Execute the provide callback function (with the given arguments) in
87
  /// a protected context which is run in another thread (optionally with a
88
  /// requested stack size).
89
  ///
90
  /// See RunSafely() and llvm_execute_on_thread().
91
  ///
92
  /// On Darwin, if PRIO_DARWIN_BG is set on the calling thread, it will be
93
  /// propagated to the new thread as well.
94
  bool RunSafelyOnThread(function_ref<void()>, unsigned RequestedStackSize = 0);
95
  bool RunSafelyOnThread(void (*Fn)(void*), void *UserData,
96
0
                         unsigned RequestedStackSize = 0) {
97
0
    return RunSafelyOnThread([&]() { Fn(UserData); }, RequestedStackSize);
98
0
  }
99
100
  /// Explicitly trigger a crash recovery in the current process, and
101
  /// return failure from RunSafely(). This function does not return.
102
  void HandleCrash();
103
};
104
105
/// Abstract base class of cleanup handlers.
106
///
107
/// Derived classes override method recoverResources, which makes actual work on
108
/// resource recovery.
109
///
110
/// Cleanup handlers are stored in a double list, which is owned and managed by
111
/// a crash recovery context.
112
class CrashRecoveryContextCleanup {
113
protected:
114
  CrashRecoveryContext *context;
115
  CrashRecoveryContextCleanup(CrashRecoveryContext *context)
116
11.8k
      : context(context), cleanupFired(false) {}
117
118
public:
119
  bool cleanupFired;
120
121
  virtual ~CrashRecoveryContextCleanup();
122
  virtual void recoverResources() = 0;
123
124
23.7k
  CrashRecoveryContext *getContext() const {
125
23.7k
    return context;
126
23.7k
  }
127
128
private:
129
  friend class CrashRecoveryContext;
130
  CrashRecoveryContextCleanup *prev, *next;
131
};
132
133
/// Base class of cleanup handler that controls recovery of resources of the
134
/// given type.
135
///
136
/// \tparam Derived Class that uses this class as a base.
137
/// \tparam T Type of controlled resource.
138
///
139
/// This class serves as a base for its template parameter as implied by
140
/// Curiously Recurring Template Pattern.
141
///
142
/// This class factors out creation of a cleanup handler. The latter requires
143
/// knowledge of the current recovery context, which is provided by this class.
144
template<typename Derived, typename T>
145
class CrashRecoveryContextCleanupBase : public CrashRecoveryContextCleanup {
146
protected:
147
  T *resource;
148
  CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T *resource)
149
8.98k
      : CrashRecoveryContextCleanup(context), resource(resource) {}
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit>, clang::ASTUnit>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, clang::ASTUnit*)
Line
Count
Source
149
960
      : CrashRecoveryContextCleanup(context), resource(resource) {}
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>, clang::DiagnosticsEngine>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, clang::DiagnosticsEngine*)
Line
Count
Source
149
1.03k
      : CrashRecoveryContextCleanup(context), resource(resource) {}
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance>, clang::CompilerInstance>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, clang::CompilerInstance*)
Line
Count
Source
149
2.59k
      : CrashRecoveryContextCleanup(context), resource(resource) {}
ASTUnit.cpp:llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction>, (anonymous namespace)::TopLevelDeclTrackerAction>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, (anonymous namespace)::TopLevelDeclTrackerAction*)
Line
Count
Source
149
1.76k
      : CrashRecoveryContextCleanup(context), resource(resource) {}
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer>, llvm::MemoryBuffer>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, llvm::MemoryBuffer*)
Line
Count
Source
149
3
      : CrashRecoveryContextCleanup(context), resource(resource) {}
Unexecuted instantiation: llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::Sema>, clang::Sema>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, clang::Sema*)
Unexecuted instantiation: ParseAST.cpp:llvm::CrashRecoveryContextCleanupBase<(anonymous namespace)::ResetStackCleanup, void const>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, void const*)
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::Parser>, clang::Parser>::CrashRecoveryContextCleanupBase(llvm::CrashRecoveryContext*, clang::Parser*)
Line
Count
Source
149
2.62k
      : CrashRecoveryContextCleanup(context), resource(resource) {}
150
151
public:
152
  /// Creates cleanup handler.
153
  /// \param x Pointer to the resource recovered by this handler.
154
  /// \return New handler or null if the method was called outside a recovery
155
  ///         context.
156
108k
  static Derived *create(T *x) {
157
108k
    if (x) {
158
92.9k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
8.98k
        return new Derived(context, x);
160
99.6k
    }
161
99.6k
    return nullptr;
162
99.6k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit>, clang::ASTUnit>::create(clang::ASTUnit*)
Line
Count
Source
156
4.73k
  static Derived *create(T *x) {
157
4.73k
    if (x) {
158
4.69k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
960
        return new Derived(context, x);
160
3.77k
    }
161
3.77k
    return nullptr;
162
3.77k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>, clang::DiagnosticsEngine>::create(clang::DiagnosticsEngine*)
Line
Count
Source
156
4.77k
  static Derived *create(T *x) {
157
4.77k
    if (x) {
158
4.77k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
1.03k
        return new Derived(context, x);
160
3.73k
    }
161
3.73k
    return nullptr;
162
3.73k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance>, clang::CompilerInstance>::create(clang::CompilerInstance*)
Line
Count
Source
156
6.22k
  static Derived *create(T *x) {
157
6.22k
    if (x) {
158
6.22k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
2.59k
        return new Derived(context, x);
160
3.62k
    }
161
3.62k
    return nullptr;
162
3.62k
  }
ASTUnit.cpp:llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction>, (anonymous namespace)::TopLevelDeclTrackerAction>::create((anonymous namespace)::TopLevelDeclTrackerAction*)
Line
Count
Source
156
5.41k
  static Derived *create(T *x) {
157
5.41k
    if (x) {
158
5.28k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
1.76k
        return new Derived(context, x);
160
3.65k
    }
161
3.65k
    return nullptr;
162
3.65k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer>, llvm::MemoryBuffer>::create(llvm::MemoryBuffer*)
Line
Count
Source
156
4.42k
  static Derived *create(T *x) {
157
4.42k
    if (x) {
158
8
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
3
        return new Derived(context, x);
160
4.41k
    }
161
4.41k
    return nullptr;
162
4.41k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::Sema>, clang::Sema>::create(clang::Sema*)
Line
Count
Source
156
113
  static Derived *create(T *x) {
157
113
    if (x) {
158
113
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
0
        return new Derived(context, x);
160
113
    }
161
113
    return nullptr;
162
113
  }
ParseAST.cpp:llvm::CrashRecoveryContextCleanupBase<(anonymous namespace)::ResetStackCleanup, void const>::create(void const*)
Line
Count
Source
156
41.4k
  static Derived *create(T *x) {
157
41.4k
    if (x) {
158
30.3k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
0
        return new Derived(context, x);
160
41.4k
    }
161
41.4k
    return nullptr;
162
41.4k
  }
llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextDeleteCleanup<clang::Parser>, clang::Parser>::create(clang::Parser*)
Line
Count
Source
156
41.4k
  static Derived *create(T *x) {
157
41.4k
    if (x) {
158
41.4k
      if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
159
2.62k
        return new Derived(context, x);
160
38.8k
    }
161
38.8k
    return nullptr;
162
38.8k
  }
163
};
164
165
/// Cleanup handler that reclaims resource by calling destructor on it.
166
template <typename T>
167
class CrashRecoveryContextDestructorCleanup : public
168
  CrashRecoveryContextCleanupBase<CrashRecoveryContextDestructorCleanup<T>, T> {
169
public:
170
  CrashRecoveryContextDestructorCleanup(CrashRecoveryContext *context,
171
                                        T *resource)
172
      : CrashRecoveryContextCleanupBase<
173
            CrashRecoveryContextDestructorCleanup<T>, T>(context, resource) {}
174
175
  virtual void recoverResources() {
176
    this->resource->~T();
177
  }
178
};
179
180
/// Cleanup handler that reclaims resource by calling 'delete' on it.
181
template <typename T>
182
class CrashRecoveryContextDeleteCleanup : public
183
  CrashRecoveryContextCleanupBase<CrashRecoveryContextDeleteCleanup<T>, T> {
184
public:
185
  CrashRecoveryContextDeleteCleanup(CrashRecoveryContext *context, T *resource)
186
    : CrashRecoveryContextCleanupBase<
187
7.95k
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, clang::ASTUnit*)
Line
Count
Source
187
960
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, clang::CompilerInstance*)
Line
Count
Source
187
2.59k
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
ASTUnit.cpp:llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, (anonymous namespace)::TopLevelDeclTrackerAction*)
Line
Count
Source
187
1.76k
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, llvm::MemoryBuffer*)
Line
Count
Source
187
3
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
Unexecuted instantiation: llvm::CrashRecoveryContextDeleteCleanup<clang::Sema>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, clang::Sema*)
llvm::CrashRecoveryContextDeleteCleanup<clang::Parser>::CrashRecoveryContextDeleteCleanup(llvm::CrashRecoveryContext*, clang::Parser*)
Line
Count
Source
187
2.62k
        CrashRecoveryContextDeleteCleanup<T>, T>(context, resource) {}
188
189
39
  void recoverResources() override { delete this->resource; }
llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit>::recoverResources()
Line
Count
Source
189
7
  void recoverResources() override { delete this->resource; }
llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance>::recoverResources()
Line
Count
Source
189
11
  void recoverResources() override { delete this->resource; }
ASTUnit.cpp:llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction>::recoverResources()
Line
Count
Source
189
8
  void recoverResources() override { delete this->resource; }
Unexecuted instantiation: llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer>::recoverResources()
Unexecuted instantiation: llvm::CrashRecoveryContextDeleteCleanup<clang::Sema>::recoverResources()
llvm::CrashRecoveryContextDeleteCleanup<clang::Parser>::recoverResources()
Line
Count
Source
189
13
  void recoverResources() override { delete this->resource; }
190
};
191
192
/// Cleanup handler that reclaims resource by calling its method 'Release'.
193
template <typename T>
194
class CrashRecoveryContextReleaseRefCleanup : public
195
  CrashRecoveryContextCleanupBase<CrashRecoveryContextReleaseRefCleanup<T>, T> {
196
public:
197
  CrashRecoveryContextReleaseRefCleanup(CrashRecoveryContext *context,
198
                                        T *resource)
199
    : CrashRecoveryContextCleanupBase<CrashRecoveryContextReleaseRefCleanup<T>,
200
1.03k
          T>(context, resource) {}
201
202
7
  void recoverResources() override { this->resource->Release(); }
203
};
204
205
/// Helper class for managing resource cleanups.
206
///
207
/// \tparam T Type of resource been reclaimed.
208
/// \tparam Cleanup Class that defines how the resource is reclaimed.
209
///
210
/// Clients create objects of this type in the code executed in a crash recovery
211
/// context to ensure that the resource will be reclaimed even in the case of
212
/// crash. For example:
213
///
214
/// \code
215
///    void actual_work(void *) {
216
///      ...
217
///      std::unique_ptr<Resource> R(new Resource());
218
///      CrashRecoveryContextCleanupRegistrar D(R.get());
219
///      ...
220
///    }
221
///
222
///    void foo() {
223
///      CrashRecoveryContext CRC;
224
///
225
///      if (!CRC.RunSafely(actual_work, 0)) {
226
///         ... a crash was detected, report error to user ...
227
///      }
228
/// \endcode
229
///
230
/// If the code of `actual_work` in the example above does not crash, the
231
/// destructor of CrashRecoveryContextCleanupRegistrar removes cleanup code from
232
/// the current CrashRecoveryContext and the resource is reclaimed by the
233
/// destructor of std::unique_ptr. If crash happens, destructors are not called
234
/// and the resource is reclaimed by cleanup object registered in the recovery
235
/// context by the constructor of CrashRecoveryContextCleanupRegistrar.
236
template <typename T, typename Cleanup = CrashRecoveryContextDeleteCleanup<T> >
237
class CrashRecoveryContextCleanupRegistrar {
238
  CrashRecoveryContextCleanup *cleanup;
239
240
public:
241
  CrashRecoveryContextCleanupRegistrar(T *x)
242
108k
    : cleanup(Cleanup::create(x)) {
243
108k
    if (cleanup)
244
8.98k
      cleanup->getContext()->registerCleanup(cleanup);
245
108k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::ASTUnit, llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit> >::CrashRecoveryContextCleanupRegistrar(clang::ASTUnit*)
Line
Count
Source
242
4.73k
    : cleanup(Cleanup::create(x)) {
243
4.73k
    if (cleanup)
244
960
      cleanup->getContext()->registerCleanup(cleanup);
245
4.73k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::DiagnosticsEngine, llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine> >::CrashRecoveryContextCleanupRegistrar(clang::DiagnosticsEngine*)
Line
Count
Source
242
4.77k
    : cleanup(Cleanup::create(x)) {
243
4.77k
    if (cleanup)
244
1.03k
      cleanup->getContext()->registerCleanup(cleanup);
245
4.77k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::CompilerInstance, llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance> >::CrashRecoveryContextCleanupRegistrar(clang::CompilerInstance*)
Line
Count
Source
242
6.22k
    : cleanup(Cleanup::create(x)) {
243
6.22k
    if (cleanup)
244
2.59k
      cleanup->getContext()->registerCleanup(cleanup);
245
6.22k
  }
ASTUnit.cpp:llvm::CrashRecoveryContextCleanupRegistrar<(anonymous namespace)::TopLevelDeclTrackerAction, llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction> >::CrashRecoveryContextCleanupRegistrar((anonymous namespace)::TopLevelDeclTrackerAction*)
Line
Count
Source
242
5.41k
    : cleanup(Cleanup::create(x)) {
243
5.41k
    if (cleanup)
244
1.76k
      cleanup->getContext()->registerCleanup(cleanup);
245
5.41k
  }
llvm::CrashRecoveryContextCleanupRegistrar<llvm::MemoryBuffer, llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer> >::CrashRecoveryContextCleanupRegistrar(llvm::MemoryBuffer*)
Line
Count
Source
242
4.42k
    : cleanup(Cleanup::create(x)) {
243
4.42k
    if (cleanup)
244
3
      cleanup->getContext()->registerCleanup(cleanup);
245
4.42k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Sema, llvm::CrashRecoveryContextDeleteCleanup<clang::Sema> >::CrashRecoveryContextCleanupRegistrar(clang::Sema*)
Line
Count
Source
242
113
    : cleanup(Cleanup::create(x)) {
243
113
    if (cleanup)
244
0
      cleanup->getContext()->registerCleanup(cleanup);
245
113
  }
ParseAST.cpp:llvm::CrashRecoveryContextCleanupRegistrar<void const, (anonymous namespace)::ResetStackCleanup>::CrashRecoveryContextCleanupRegistrar(void const*)
Line
Count
Source
242
41.4k
    : cleanup(Cleanup::create(x)) {
243
41.4k
    if (cleanup)
244
0
      cleanup->getContext()->registerCleanup(cleanup);
245
41.4k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Parser, llvm::CrashRecoveryContextDeleteCleanup<clang::Parser> >::CrashRecoveryContextCleanupRegistrar(clang::Parser*)
Line
Count
Source
242
41.4k
    : cleanup(Cleanup::create(x)) {
243
41.4k
    if (cleanup)
244
2.62k
      cleanup->getContext()->registerCleanup(cleanup);
245
41.4k
  }
246
247
108k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<clang::ASTUnit, llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
4.72k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<clang::DiagnosticsEngine, llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
4.76k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<clang::CompilerInstance, llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
6.21k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
ASTUnit.cpp:llvm::CrashRecoveryContextCleanupRegistrar<(anonymous namespace)::TopLevelDeclTrackerAction, llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
5.40k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<llvm::MemoryBuffer, llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
4.41k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Sema, llvm::CrashRecoveryContextDeleteCleanup<clang::Sema> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
113
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
ParseAST.cpp:llvm::CrashRecoveryContextCleanupRegistrar<void const, (anonymous namespace)::ResetStackCleanup>::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
41.4k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Parser, llvm::CrashRecoveryContextDeleteCleanup<clang::Parser> >::~CrashRecoveryContextCleanupRegistrar()
Line
Count
Source
247
41.4k
  ~CrashRecoveryContextCleanupRegistrar() { unregister(); }
248
249
108k
  void unregister() {
250
108k
    if (cleanup && 
!cleanup->cleanupFired8.94k
)
251
8.94k
      cleanup->getContext()->unregisterCleanup(cleanup);
252
108k
    cleanup = nullptr;
253
108k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::ASTUnit, llvm::CrashRecoveryContextDeleteCleanup<clang::ASTUnit> >::unregister()
Line
Count
Source
249
4.72k
  void unregister() {
250
4.72k
    if (cleanup && 
!cleanup->cleanupFired953
)
251
953
      cleanup->getContext()->unregisterCleanup(cleanup);
252
4.72k
    cleanup = nullptr;
253
4.72k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::DiagnosticsEngine, llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine> >::unregister()
Line
Count
Source
249
4.76k
  void unregister() {
250
4.76k
    if (cleanup && 
!cleanup->cleanupFired1.02k
)
251
1.02k
      cleanup->getContext()->unregisterCleanup(cleanup);
252
4.76k
    cleanup = nullptr;
253
4.76k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::CompilerInstance, llvm::CrashRecoveryContextDeleteCleanup<clang::CompilerInstance> >::unregister()
Line
Count
Source
249
6.21k
  void unregister() {
250
6.21k
    if (cleanup && 
!cleanup->cleanupFired2.58k
)
251
2.58k
      cleanup->getContext()->unregisterCleanup(cleanup);
252
6.21k
    cleanup = nullptr;
253
6.21k
  }
ASTUnit.cpp:llvm::CrashRecoveryContextCleanupRegistrar<(anonymous namespace)::TopLevelDeclTrackerAction, llvm::CrashRecoveryContextDeleteCleanup<(anonymous namespace)::TopLevelDeclTrackerAction> >::unregister()
Line
Count
Source
249
5.40k
  void unregister() {
250
5.40k
    if (cleanup && 
!cleanup->cleanupFired1.75k
)
251
1.75k
      cleanup->getContext()->unregisterCleanup(cleanup);
252
5.40k
    cleanup = nullptr;
253
5.40k
  }
llvm::CrashRecoveryContextCleanupRegistrar<llvm::MemoryBuffer, llvm::CrashRecoveryContextDeleteCleanup<llvm::MemoryBuffer> >::unregister()
Line
Count
Source
249
4.41k
  void unregister() {
250
4.41k
    if (cleanup && 
!cleanup->cleanupFired3
)
251
3
      cleanup->getContext()->unregisterCleanup(cleanup);
252
4.41k
    cleanup = nullptr;
253
4.41k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Sema, llvm::CrashRecoveryContextDeleteCleanup<clang::Sema> >::unregister()
Line
Count
Source
249
113
  void unregister() {
250
113
    if (cleanup && 
!cleanup->cleanupFired0
)
251
0
      cleanup->getContext()->unregisterCleanup(cleanup);
252
113
    cleanup = nullptr;
253
113
  }
ParseAST.cpp:llvm::CrashRecoveryContextCleanupRegistrar<void const, (anonymous namespace)::ResetStackCleanup>::unregister()
Line
Count
Source
249
41.4k
  void unregister() {
250
41.4k
    if (cleanup && 
!cleanup->cleanupFired0
)
251
0
      cleanup->getContext()->unregisterCleanup(cleanup);
252
41.4k
    cleanup = nullptr;
253
41.4k
  }
llvm::CrashRecoveryContextCleanupRegistrar<clang::Parser, llvm::CrashRecoveryContextDeleteCleanup<clang::Parser> >::unregister()
Line
Count
Source
249
41.4k
  void unregister() {
250
41.4k
    if (cleanup && 
!cleanup->cleanupFired2.61k
)
251
2.61k
      cleanup->getContext()->unregisterCleanup(cleanup);
252
41.4k
    cleanup = nullptr;
253
41.4k
  }
254
};
255
} // end namespace llvm
256
257
#endif // LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H