Replace HostInfo::GetLLDBPath with specific functions
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. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
This commit is contained in:
@@ -32,24 +32,43 @@ SBFileSpec SBHostOS::GetProgramFileSpec() {
|
||||
}
|
||||
|
||||
SBFileSpec SBHostOS::GetLLDBPythonPath() {
|
||||
SBFileSpec sb_lldb_python_filespec;
|
||||
FileSpec lldb_python_spec;
|
||||
if (HostInfo::GetLLDBPath(ePathTypePythonDir, lldb_python_spec)) {
|
||||
sb_lldb_python_filespec.SetFileSpec(lldb_python_spec);
|
||||
}
|
||||
return sb_lldb_python_filespec;
|
||||
return GetLLDBPath(ePathTypePythonDir);
|
||||
}
|
||||
|
||||
SBFileSpec SBHostOS::GetLLDBPath(lldb::PathType path_type) {
|
||||
SBFileSpec sb_fspec;
|
||||
FileSpec fspec;
|
||||
bool Success = true;
|
||||
if (path_type == ePathTypeClangDir)
|
||||
switch (path_type) {
|
||||
case ePathTypeLLDBShlibDir:
|
||||
fspec = HostInfo::GetShlibDir();
|
||||
break;
|
||||
case ePathTypeSupportExecutableDir:
|
||||
fspec = HostInfo::GetSupportExeDir();
|
||||
break;
|
||||
case ePathTypeHeaderDir:
|
||||
fspec = HostInfo::GetHeaderDir();
|
||||
break;
|
||||
case ePathTypePythonDir:
|
||||
fspec = HostInfo::GetPythonDir();
|
||||
break;
|
||||
case ePathTypeLLDBSystemPlugins:
|
||||
fspec = HostInfo::GetSystemPluginDir();
|
||||
break;
|
||||
case ePathTypeLLDBUserPlugins:
|
||||
fspec = HostInfo::GetUserPluginDir();
|
||||
break;
|
||||
case ePathTypeLLDBTempSystemDir:
|
||||
fspec = HostInfo::GetProcessTempDir();
|
||||
break;
|
||||
case ePathTypeGlobalLLDBTempSystemDir:
|
||||
fspec = HostInfo::GetGlobalTempDir();
|
||||
break;
|
||||
case ePathTypeClangDir:
|
||||
fspec = GetClangResourceDir();
|
||||
else
|
||||
Success = HostInfo::GetLLDBPath(path_type, fspec);
|
||||
if (Success)
|
||||
sb_fspec.SetFileSpec(fspec);
|
||||
break;
|
||||
}
|
||||
|
||||
SBFileSpec sb_fspec;
|
||||
sb_fspec.SetFileSpec(fspec);
|
||||
return sb_fspec;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user