[PATCH] D100151: Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 16:32:40 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG022ccedde887: Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC (authored by dexonsmith).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100151/new/

https://reviews.llvm.org/D100151

Files:
  llvm/include/llvm/Support/Signposts.h
  llvm/lib/Support/Signposts.cpp


Index: llvm/lib/Support/Signposts.cpp
===================================================================
--- llvm/lib/Support/Signposts.cpp
+++ 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<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
Index: llvm/include/llvm/Support/Signposts.h
===================================================================
--- llvm/include/llvm/Support/Signposts.h
+++ llvm/include/llvm/Support/Signposts.h
@@ -18,6 +18,7 @@
 #define LLVM_SUPPORT_SIGNPOSTS_H
 
 #include "llvm/ADT/StringRef.h"
+#include <memory>
 
 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<SignpostEmitterImpl> Impl;
 
 public:
   SignpostEmitter();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100151.336265.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210408/5adee576/attachment.bin>


More information about the llvm-commits mailing list