forked from OSchip/llvm-project
Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC""
This reverts commit078072285d
, reapplying022ccedde8
. I figured out why this was failing in other environments: it's not a problem with std::unique_ptr, but that SignpostEmitterImpl only has a forward declaration. Adding an empty definition should do the trick. Original commit message: Replace some manual memory management with std::unique_ptr. Differential Revision: https://reviews.llvm.org/D100151
This commit is contained in:
parent
078072285d
commit
e7ed5c920d
|
@ -18,6 +18,7 @@
|
|||
#define LLVM_SUPPORT_SIGNPOSTS_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
class SignpostEmitterImpl;
|
||||
|
@ -25,8 +26,7 @@ class SignpostEmitterImpl;
|
|||
/// Manages the emission of signposts into the recording method supported by
|
||||
/// the OS.
|
||||
class SignpostEmitter {
|
||||
/// Not using std::unique_ptr since some hosts need a definition.
|
||||
SignpostEmitterImpl *Impl;
|
||||
std::unique_ptr<SignpostEmitterImpl> Impl;
|
||||
|
||||
public:
|
||||
SignpostEmitter();
|
||||
|
|
|
@ -96,21 +96,18 @@ public:
|
|||
#define HAVE_ANY_SIGNPOST_IMPL 1
|
||||
#else
|
||||
#define HAVE_ANY_SIGNPOST_IMPL 0
|
||||
|
||||
/// Definition necessary for use of std::unique_ptr.
|
||||
class SignpostEmitterImpl {};
|
||||
#endif
|
||||
|
||||
SignpostEmitter::SignpostEmitter() {
|
||||
#if HAVE_ANY_SIGNPOST_IMPL
|
||||
Impl = new SignpostEmitterImpl();
|
||||
#else // if HAVE_ANY_SIGNPOST_IMPL
|
||||
Impl = nullptr;
|
||||
Impl = std::make_unique<SignpostEmitterImpl>();
|
||||
#endif // if !HAVE_ANY_SIGNPOST_IMPL
|
||||
}
|
||||
|
||||
SignpostEmitter::~SignpostEmitter() {
|
||||
#if HAVE_ANY_SIGNPOST_IMPL
|
||||
delete Impl;
|
||||
#endif // if HAVE_ANY_SIGNPOST_IMPL
|
||||
}
|
||||
SignpostEmitter::~SignpostEmitter() = default;
|
||||
|
||||
bool SignpostEmitter::isEnabled() const {
|
||||
#if HAVE_ANY_SIGNPOST_IMPL
|
||||
|
|
Loading…
Reference in New Issue