diff --git a/llvm/include/llvm/Support/Signposts.h b/llvm/include/llvm/Support/Signposts.h --- a/llvm/include/llvm/Support/Signposts.h +++ b/llvm/include/llvm/Support/Signposts.h @@ -18,6 +18,7 @@ #define LLVM_SUPPORT_SIGNPOSTS_H #include "llvm/ADT/StringRef.h" +#include namespace llvm { class SignpostEmitterImpl; @@ -25,7 +26,7 @@ /// Manages the emission of signposts into the recording method supported by /// the OS. class SignpostEmitter { - SignpostEmitterImpl *Impl; + std::unique_ptr Impl; public: SignpostEmitter(); diff --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp --- a/llvm/lib/Support/Signposts.cpp +++ b/llvm/lib/Support/Signposts.cpp @@ -98,17 +98,11 @@ SignpostEmitter::SignpostEmitter() { #if HAVE_ANY_SIGNPOST_IMPL - Impl = new SignpostEmitterImpl(); -#else // if HAVE_ANY_SIGNPOST_IMPL - Impl = nullptr; + Impl = std::make_unique(); #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