[TimeProfiler] Reset variable to nullptr
authorShoaib Meenai <smeenai@fb.com>
Sat, 30 Oct 2021 23:49:20 +0000 (16:49 -0700)
committerShoaib Meenai <smeenai@fb.com>
Sun, 31 Oct 2021 23:14:30 +0000 (16:14 -0700)
commit0cf624cad7a0afbac638835cba279dd42adcc39d
tree893f638e5a47f6ed45ecc727c3f265d79f1fe661
parent0f6d720f1f485b7a1842170b571e6b9af7bcaa0e
[TimeProfiler] Reset variable to nullptr

Otherwise we'll hit a spurious assert failure when we reset and then
reinitialize TimeProfiler on the same thread, as can happen when e.g.
using LLD as a library and running it multiple times in the same
process.

Makes `lld/test/MachO/time-trace.s` pass with `LLD_IN_TEST=2`, which
runs the linker twice in the same process and exposed the issue.

Reviewed By: MaskRay, mehdi_amini

Differential Revision: https://reviews.llvm.org/D112880
llvm/lib/Support/TimeProfiler.cpp