This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove unused code in GetVersion (NFC)
ClosedPublic

Authored by kastiglione on Oct 6 2020, 6:25 PM.

Details

Summary

Small cleanup to lldb_private::GetVersion().

Diff Detail

Event Timeline

kastiglione created this revision.Oct 6 2020, 6:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2020, 6:25 PM
kastiglione requested review of this revision.Oct 6 2020, 6:25 PM

Unbreak code

switch NULL to ""

kastiglione added inline comments.Oct 6 2020, 7:16 PM
lldb/source/lldb.cpp
22

this won't expand to a string as is, does this indicate it's unused?

LLDB_REVISION and LLDB_REPOSITORY are coming from VCSVersion.inc where it should be defined as a string. However the generation of that file seems to be broken since the monorepo migration. I put up a patch here that gets this working again: D88950

There is also the framework script that tries to define LLDB_REVISION but I assume that's only used for the headers we ship in the Framework? Not 100% sure what's going on with that.

Beside that, I think this code can really use some cleanup. I added some comments what else can be removed/updated.

lldb/source/lldb.cpp
20

This can return a string.

29

You can remove that comment too, it's from a time where there was special Darwin version code.

teemperor requested changes to this revision.Oct 7 2020, 2:21 AM
This revision now requires changes to proceed.Oct 7 2020, 2:21 AM

Restore repository handling

kastiglione edited the summary of this revision. (Show Details)Oct 7 2020, 8:43 AM

@teemperor I removed the comment and restored repository handling. It becomes much more of a useless diff :)

Update commit message

teemperor accepted this revision.Oct 7 2020, 11:44 AM

Yeah there isn't a lot of unused code left here. If you want you can make a follow up replacing all the C-string logic with std::string (and removing the static local result var as that seems unnecessary).

This revision is now accepted and ready to land.Oct 7 2020, 11:44 AM
This revision was landed with ongoing or failed builds.Oct 12 2020, 4:31 PM
This revision was automatically updated to reflect the committed changes.