[llvm] e35afbe - Revert "Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC"""

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


Author: Duncan P. N. Exon Smith
Date: 2021-04-08T16:58:12-07:00
New Revision: e35afbe535f96086141f57a5ce7d679429b4405f

URL: https://github.com/llvm/llvm-project/commit/e35afbe535f96086141f57a5ce7d679429b4405f
DIFF: https://github.com/llvm/llvm-project/commit/e35afbe535f96086141f57a5ce7d679429b4405f.diff

LOG: Revert "Revert "Revert "Support: Use std::unique_ptr for SignpostEmitter::Impl, NFC"""

This reverts commit e7ed5c920db3f537a85d962c1c918a1bb6de99fd again, due
to more buildbot failures:
https://lab.llvm.org/buildbot/#/builders/131/builds/8191

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Signposts.h b/llvm/include/llvm/Support/Signposts.h
index d31f3c1e6eb5..22b04893394e 100644
--- a/llvm/include/llvm/Support/Signposts.h
+++ b/llvm/include/llvm/Support/Signposts.h
@@ -18,7 +18,6 @@
 #define LLVM_SUPPORT_SIGNPOSTS_H
 
 #include "llvm/ADT/StringRef.h"
-#include <memory>
 
 namespace llvm {
 class SignpostEmitterImpl;
@@ -26,7 +25,8 @@ class SignpostEmitterImpl;
 /// Manages the emission of signposts into the recording method supported by
 /// the OS.
 class SignpostEmitter {
-  std::unique_ptr<SignpostEmitterImpl> Impl;
+  /// Not using std::unique_ptr since some hosts need a definition.
+  SignpostEmitterImpl *Impl;
 
 public:
   SignpostEmitter();

diff  --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp
index 9d1fdeddba7c..b277bb02e03a 100644
--- a/llvm/lib/Support/Signposts.cpp
+++ b/llvm/lib/Support/Signposts.cpp
@@ -96,18 +96,21 @@ class SignpostEmitterImpl {
 #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 = std::make_unique<SignpostEmitterImpl>();
+  Impl = new SignpostEmitterImpl();
+#else  // if HAVE_ANY_SIGNPOST_IMPL
+  Impl = nullptr;
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
 
-SignpostEmitter::~SignpostEmitter() = default;
+SignpostEmitter::~SignpostEmitter() {
+#if HAVE_ANY_SIGNPOST_IMPL
+  delete Impl;
+#endif // if HAVE_ANY_SIGNPOST_IMPL
+}
 
 bool SignpostEmitter::isEnabled() const {
 #if HAVE_ANY_SIGNPOST_IMPL


        


More information about the llvm-commits mailing list