This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Make that we can call HostInfo::Initialize and HostInfo::Terminate multiple times
ClosedPublic

Authored by teemperor on Dec 20 2019, 2:49 AM.

Details

Summary

HostInfo's state isn't actually fully rested after calling ::Terminate. Currently we only reset the
values of all the HostInfoBaseFields but not all the variables with static storage that
keep track of whether the fields need to be initialised. This breaks random unit tests as running
them twice (or running multiple test instances in one run) will cause that the second time
we ask HostInfo for any information we get the default value back for any field.

This patch moves all the once_flag's into the HostInfoBaseFields so that they also get reseted
by ::Terminate and removes all the success bools. We should also rewrite half this code but
I would prefer if my tests aren't broken over the holidays so let's just put some duct tape on it
for now.

Diff Detail

Event Timeline

teemperor created this revision.Dec 20 2019, 2:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2019, 2:49 AM
labath accepted this revision.Dec 20 2019, 3:04 AM

Yeah, this code could use a rewrite, but this is definitely better...

This revision is now accepted and ready to land.Dec 20 2019, 3:04 AM
This revision was automatically updated to reflect the committed changes.