This is an archive of the discontinued LLVM Phabricator instance.

Remove Timer::Initialize routine
ClosedPublic

Authored by labath on Jan 29 2016, 6:39 AM.

Details

Summary

I've run into an issue when running unit tests, where the underlying problem turned out to be
that we were creating Timer objects (through several layers of indirection) without calling
Timer::Initialize. Since Timer's thread-local storage was not properly initialized, we were
overwriting gtest's own thread-local storage, causing test failures.

Instead of requiring that every test calls Timer::Initialize(), I remove the function altogether:
The thread-local storage can be initialized on-demand, and the g_file variable initialized to
stdout and never changed, so I have simply removed it.

Diff Detail

Repository
rL LLVM

Event Timeline

labath updated this revision to Diff 46380.Jan 29 2016, 6:39 AM
labath retitled this revision from to Remove Timer::Initialize routine.
labath updated this object.
labath added reviewers: clayborg, zturner, tberghammer.
labath added a subscriber: lldb-commits.
zturner added inline comments.Jan 29 2016, 8:35 AM
source/Core/Timer.cpp
68 ↗(On Diff #46380)

What did we decide about the C++11 thread_local keyword? I know it's been blocked on MSVC compiler support, but now that we're basically up to VS2015 on Windows...

clayborg accepted this revision.Jan 29 2016, 2:58 PM
clayborg edited edge metadata.

Looks fine. Zach: I don't believe that Mac supports the thread local keywords correctly yet, but I can check on that. We would need to get the OK from multiple people (MacOSX, Windows, FreeBSD, Linux and Android) before we could think of switching...

This revision is now accepted and ready to land.Jan 29 2016, 2:58 PM
labath added a comment.Feb 1 2016, 5:11 AM

We are still using VS2013 at the moment, but we have started to investigate the possibility of migrating to 2015. I can report back when I know more, but I would leave the thread_local keyword out for now.

This revision was automatically updated to reflect the committed changes.