[PATCH] D38121: [XRay][compiler-rt] Remove non-trivial globals from xray_log_interface.cc

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 03:18:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313871: [XRay][compiler-rt] Remove non-trivial globals from xray_log_interface.cc (authored by dberris).

Repository:
  rL LLVM

https://reviews.llvm.org/D38121

Files:
  compiler-rt/trunk/lib/xray/xray_log_interface.cc


Index: compiler-rt/trunk/lib/xray/xray_log_interface.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_log_interface.cc
+++ compiler-rt/trunk/lib/xray/xray_log_interface.cc
@@ -17,30 +17,30 @@
 #include "xray/xray_interface.h"
 #include "xray_defs.h"
 
-#include <memory>
-
 __sanitizer::SpinMutex XRayImplMutex;
-std::unique_ptr<XRayLogImpl> GlobalXRayImpl;
+XRayLogImpl *GlobalXRayImpl = nullptr;
 
 void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {
   if (Impl.log_init == nullptr || Impl.log_finalize == nullptr ||
       Impl.handle_arg0 == nullptr || Impl.flush_log == nullptr) {
     __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
-    GlobalXRayImpl.reset();
+    delete GlobalXRayImpl;
+    GlobalXRayImpl = nullptr;
     __xray_remove_handler();
     __xray_remove_handler_arg1();
     return;
   }
 
   __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
-  GlobalXRayImpl.reset(new XRayLogImpl);
+  GlobalXRayImpl = new XRayLogImpl();
   *GlobalXRayImpl = Impl;
   __xray_set_handler(Impl.handle_arg0);
 }
 
 void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {
   __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
-  GlobalXRayImpl.reset();
+  delete GlobalXRayImpl;
+  GlobalXRayImpl = nullptr;
   __xray_remove_handler();
   __xray_remove_handler_arg1();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38121.116161.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170921/2a31048a/attachment.bin>


More information about the llvm-commits mailing list