diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-04-08 16:41:40 -0700 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-04-08 16:50:39 -0700 |
commit | e7ed5c920db3f537a85d962c1c918a1bb6de99fd (patch) | |
tree | a39349d0e22dc33c191703365396105b506d731f /llvm/lib/Support/Signposts.cpp | |
parent | 078072285d3fbdaa94f9a91140eb5c1223b548af (diff) | |
download | llvm-e7ed5c920db3f537a85d962c1c918a1bb6de99fd.zip llvm-e7ed5c920db3f537a85d962c1c918a1bb6de99fd.tar.gz llvm-e7ed5c920db3f537a85d962c1c918a1bb6de99fd.tar.bz2 |
Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC""
This reverts commit 078072285d3fbdaa94f9a91140eb5c1223b548af, reapplying
022ccedde8877e877b45e49641544b5e4fff0b42.
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
Diffstat (limited to 'llvm/lib/Support/Signposts.cpp')
-rw-r--r-- | llvm/lib/Support/Signposts.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp index b277bb0..9d1fded 100644 --- a/llvm/lib/Support/Signposts.cpp +++ b/llvm/lib/Support/Signposts.cpp @@ -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 |