LLDB mainline
|
A Clang configuration when importing C++ modules. More...
#include <CppModuleConfiguration.h>
Classes | |
class | SetOncePath |
Utility class for a path that can only be set once. More... | |
Public Member Functions | |
CppModuleConfiguration (const FileSpecList &support_files, const llvm::Triple &triple) | |
Creates a configuration by analyzing the given list of used source files. | |
CppModuleConfiguration ()=default | |
Creates an empty and invalid configuration. | |
bool | hasValidConfig () |
Returns true iff this is a valid configuration that can be used to load and compile modules. | |
llvm::ArrayRef< std::string > | GetIncludeDirs () const |
Returns a list of include directories that should be used when using this configuration (e.g. | |
llvm::ArrayRef< std::string > | GetImportedModules () const |
Returns a list of (top level) modules that should be imported when using this configuration (e.g. | |
Private Member Functions | |
bool | analyzeFile (const FileSpec &f, const llvm::Triple &triple) |
Analyze a given source file to build the current configuration. | |
Private Attributes | |
SetOncePath | m_std_inc |
If valid, the include path used for the std module. | |
SetOncePath | m_std_target_inc |
If valid, the per-target include path used for the std module. | |
SetOncePath | m_c_inc |
If valid, the include path to the C library (e.g. /usr/include). | |
SetOncePath | m_c_target_inc |
If valid, the include path to target-specific C library files (e.g. | |
std::string | m_resource_inc |
The Clang resource include path for this configuration. | |
std::vector< std::string > | m_include_dirs |
std::vector< std::string > | m_imported_modules |
A Clang configuration when importing C++ modules.
This class computes a list of include paths and module names that can be imported given a list of source files. Currently only used when importing the 'std' module and its dependencies.
Definition at line 22 of file CppModuleConfiguration.h.
|
explicit |
Creates a configuration by analyzing the given list of used source files.
The triple (if valid) is used to search for target-specific include paths.
Definition at line 134 of file CppModuleConfiguration.cpp.
References analyzeFile(), error(), lldb_private::CppModuleConfiguration::SetOncePath::Get(), lldb_private::GetClangResourceDir(), hasValidConfig(), m_c_inc, m_c_target_inc, m_imported_modules, m_include_dirs, m_resource_inc, m_std_inc, m_std_target_inc, and lldb_private::CppModuleConfiguration::SetOncePath::Valid().
|
default |
Creates an empty and invalid configuration.
|
private |
Analyze a given source file to build the current configuration.
Returns false iff there was a fatal error that makes analyzing any further files pointless as the configuration is now invalid.
Definition at line 62 of file CppModuleConfiguration.cpp.
References lldb_private::FileSpec::GetDirectory(), lldb_private::FileSpec::GetPath(), lldb_private::ConstString::GetStringRef(), getTargetIncludePaths(), guessIncludePath(), m_c_inc, m_c_target_inc, m_std_inc, m_std_target_inc, and lldb_private::CppModuleConfiguration::SetOncePath::TrySet().
Referenced by CppModuleConfiguration().
|
inline |
Returns a list of (top level) modules that should be imported when using this configuration (e.g.
{"std"}).
Definition at line 83 of file CppModuleConfiguration.h.
References m_imported_modules.
Referenced by lldb_private::ClangUserExpression::SetupCppModuleImports().
|
inline |
Returns a list of include directories that should be used when using this configuration (e.g.
{"/usr/include", "/usr/include/c++/v1"}).
Definition at line 79 of file CppModuleConfiguration.h.
References m_include_dirs.
Referenced by lldb_private::ClangUserExpression::SetupCppModuleImports().
bool CppModuleConfiguration::hasValidConfig | ( | ) |
Returns true iff this is a valid configuration that can be used to load and compile modules.
Definition at line 107 of file CppModuleConfiguration.cpp.
References lldb_private::CppModuleConfiguration::SetOncePath::Get(), lldb_private::FileSystem::Instance(), m_c_inc, m_std_inc, MakePath(), and lldb_private::CppModuleConfiguration::SetOncePath::Valid().
Referenced by CppModuleConfiguration().
|
private |
If valid, the include path to the C library (e.g. /usr/include).
Definition at line 49 of file CppModuleConfiguration.h.
Referenced by analyzeFile(), CppModuleConfiguration(), and hasValidConfig().
|
private |
If valid, the include path to target-specific C library files (e.g.
/usr/include/x86_64-linux-gnu). This is an optional path only required on some systems.
Definition at line 53 of file CppModuleConfiguration.h.
Referenced by analyzeFile(), and CppModuleConfiguration().
|
private |
Definition at line 58 of file CppModuleConfiguration.h.
Referenced by CppModuleConfiguration(), and GetImportedModules().
|
private |
Definition at line 57 of file CppModuleConfiguration.h.
Referenced by CppModuleConfiguration(), and GetIncludeDirs().
|
private |
The Clang resource include path for this configuration.
Definition at line 55 of file CppModuleConfiguration.h.
Referenced by CppModuleConfiguration().
|
private |
If valid, the include path used for the std module.
Definition at line 44 of file CppModuleConfiguration.h.
Referenced by analyzeFile(), CppModuleConfiguration(), and hasValidConfig().
|
private |
If valid, the per-target include path used for the std module.
This is an optional path only required on some systems.
Definition at line 47 of file CppModuleConfiguration.h.
Referenced by analyzeFile(), and CppModuleConfiguration().