[lldb-dev] Would Host be better off as a non-static?

Greg Clayton gclayton at apple.com
Tue Aug 12 16:16:55 PDT 2014


> On Aug 12, 2014, at 4:05 PM, Zachary Turner <zturner at google.com> wrote:
> 
> The main benefit is just cleaner code.  And really it will only just be 1 instance, since it will be a singleton.  So instead of writing Host::DoSoemthing() it would be Host::GetInstance()->DoSomething().
> 
> That being said, I have some other ideas as well.  I feel like maybe Host just ended up being the default place to put any function which needed to interface with the platform.  For example, I see  file-system stuff in Host, process launching stuff, and more.  I'm currently thinking about maybe separating the stuff in Host into different logical groups, and then moving that functionality into their own Host-layer classes.  So we'd have lldb_host::FileSystem, for example, which would contain the Readlink, Unlink, etc functions.  And an lldb_host::ProcessLauncher interface, which would support different ways of launching processes, with derived implementations such as PosixSpawnProcessLauncher, ExecProcessLauncher, ForkProcessLauncher, WindowsProcessLauncher, etc etc.  Then existing code that launches processes could use these classes instead.  
> 
> Thoughts?

All possible, and any cleanup is good. Feel free to use your time as you see fit! We don't mind benefitting from your work.

Greg



More information about the lldb-dev mailing list