[compiler-rt] r313871 - [XRay][compiler-rt] Remove non-trivial globals from xray_log_interface.cc
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 21 03:16:56 PDT 2017
Author: dberris
Date: Thu Sep 21 03:16:56 2017
New Revision: 313871
URL: http://llvm.org/viewvc/llvm-project?rev=313871&view=rev
Log:
[XRay][compiler-rt] Remove non-trivial globals from xray_log_interface.cc
Summary:
Remove dependency on std::unique_ptr<...> for the global representing
the installed XRay implementation.
Reviewers: dblaikie, kpw, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38121
Modified:
compiler-rt/trunk/lib/xray/xray_log_interface.cc
Modified: compiler-rt/trunk/lib/xray/xray_log_interface.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_log_interface.cc?rev=313871&r1=313870&r2=313871&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_log_interface.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_log_interface.cc Thu Sep 21 03:16:56 2017
@@ -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();
}
More information about the llvm-commits
mailing list