This is an archive of the discontinued LLVM Phabricator instance.

Replace HostInfo::GetLLDBPath with specific functions
ClosedPublic

Authored by labath on Jun 18 2018, 3:57 AM.

Details

Summary

Instead of a function taking an enum value determining which path to
return, we now have a suite of functions, each returning a single path
kind. This makes it easy to move the python-path function into a
specific plugin in a follow-up commit.

All the users of GetLLDBPath were converted to call specific functions
instead. Most of them were hard-coding the enum value anyway, so this
conversion was simple. The only exception was SBHostOS, which I've
changed to use a switch on the incoming enum value.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jun 18 2018, 3:57 AM
clayborg accepted this revision.Jun 18 2018, 9:31 AM

Looks good. My only question is do we not require people to only fill in the directory portion of the FileSpec anymore for these functions? I am fine with way since hopefully FileSpec::AppendPathComponent handles things correctly.

This revision is now accepted and ready to land.Jun 18 2018, 9:31 AM

Looks good. My only question is do we not require people to only fill in the directory portion of the FileSpec anymore for these functions? I am fine with way since hopefully FileSpec::AppendPathComponent handles things correctly.

I'm not sure if anyone actually depends on this behavior, but there is a test which actually requires this (TestPaths.py). I did consider dropping this promise for the internal API and doing the fixup in the SB layer, but I chose not to go along with that for now. I believe AppendPathComponent et al. will mostly work for these kinds of FileSpecs, but they are definitely a less well tested path.

This revision was automatically updated to reflect the committed changes.