Skip to content

Commit c14b5f2

Browse files
committedSep 21, 2017
[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 llvm-svn: 313871
1 parent 29202f6 commit c14b5f2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎compiler-rt/lib/xray/xray_log_interface.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@
1717
#include "xray/xray_interface.h"
1818
#include "xray_defs.h"
1919

20-
#include <memory>
21-
2220
__sanitizer::SpinMutex XRayImplMutex;
23-
std::unique_ptr<XRayLogImpl> GlobalXRayImpl;
21+
XRayLogImpl *GlobalXRayImpl = nullptr;
2422

2523
void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {
2624
if (Impl.log_init == nullptr || Impl.log_finalize == nullptr ||
2725
Impl.handle_arg0 == nullptr || Impl.flush_log == nullptr) {
2826
__sanitizer::SpinMutexLock Guard(&XRayImplMutex);
29-
GlobalXRayImpl.reset();
27+
delete GlobalXRayImpl;
28+
GlobalXRayImpl = nullptr;
3029
__xray_remove_handler();
3130
__xray_remove_handler_arg1();
3231
return;
3332
}
3433

3534
__sanitizer::SpinMutexLock Guard(&XRayImplMutex);
36-
GlobalXRayImpl.reset(new XRayLogImpl);
35+
GlobalXRayImpl = new XRayLogImpl();
3736
*GlobalXRayImpl = Impl;
3837
__xray_set_handler(Impl.handle_arg0);
3938
}
4039

4140
void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {
4241
__sanitizer::SpinMutexLock Guard(&XRayImplMutex);
43-
GlobalXRayImpl.reset();
42+
delete GlobalXRayImpl;
43+
GlobalXRayImpl = nullptr;
4444
__xray_remove_handler();
4545
__xray_remove_handler_arg1();
4646
}

0 commit comments

Comments
 (0)
Please sign in to comment.