LLDB  mainline
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::CppModuleConfiguration Class Reference

A Clang configuration when importing C++ modules. More...

#include <CppModuleConfiguration.h>

Collaboration diagram for lldb_private::CppModuleConfiguration:
Collaboration graph
[legend]

Classes

class  SetOncePath
 Utility class for a path that can only be set once. More...
 

Public Member Functions

 CppModuleConfiguration (const FileSpecList &support_files)
 Creates a configuration by analyzing the given list of used source files. More...
 
 CppModuleConfiguration ()=default
 Creates an empty and invalid configuration. More...
 
bool hasValidConfig ()
 Returns true iff this is a valid configuration that can be used to load and compile modules. More...
 
llvm::ArrayRef< std::stringGetIncludeDirs () const
 Returns a list of include directories that should be used when using this configuration (e.g. More...
 
llvm::ArrayRef< std::stringGetImportedModules () const
 Returns a list of (top level) modules that should be imported when using this configuration (e.g. More...
 

Private Member Functions

bool analyzeFile (const FileSpec &f)
 Analyze a given source file to build the current configuration. More...
 

Private Attributes

SetOncePath m_std_inc
 If valid, the include path used for the std module. More...
 
SetOncePath m_c_inc
 If valid, the include path to the C library (e.g. /usr/include). More...
 
std::string m_resource_inc
 The Clang resource include path for this configuration. More...
 
std::vector< std::stringm_include_dirs
 
std::vector< std::stringm_imported_modules
 

Detailed Description

A Clang configuration when importing C++ modules.

Includes a list of include paths that should be used when importing and a list of modules that can be imported. Currently only used when importing the 'std' module and its dependencies.

Definition at line 22 of file CppModuleConfiguration.h.

Constructor & Destructor Documentation

◆ CppModuleConfiguration() [1/2]

CppModuleConfiguration::CppModuleConfiguration ( const FileSpecList &  support_files)
explicit

◆ CppModuleConfiguration() [2/2]

lldb_private::CppModuleConfiguration::CppModuleConfiguration ( )
default

Creates an empty and invalid configuration.

Member Function Documentation

◆ analyzeFile()

bool CppModuleConfiguration::analyzeFile ( const FileSpec f)
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 33 of file CppModuleConfiguration.cpp.

References lldb_private::FileSpec::GetDirectory(), lldb_private::FileSpec::GetPath(), lldb_private::ConstString::GetStringRef(), m_c_inc, m_std_inc, string(), and lldb_private::CppModuleConfiguration::SetOncePath::TrySet().

Referenced by CppModuleConfiguration().

◆ GetImportedModules()

llvm::ArrayRef<std::string> lldb_private::CppModuleConfiguration::GetImportedModules ( ) const
inline

Returns a list of (top level) modules that should be imported when using this configuration (e.g.

{"std"}).

Definition at line 74 of file CppModuleConfiguration.h.

References m_imported_modules.

Referenced by lldb_private::ClangUserExpression::SetupCppModuleImports().

◆ GetIncludeDirs()

llvm::ArrayRef<std::string> lldb_private::CppModuleConfiguration::GetIncludeDirs ( ) const
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 70 of file CppModuleConfiguration.h.

References m_include_dirs.

Referenced by lldb_private::ClangUserExpression::SetupCppModuleImports().

◆ hasValidConfig()

bool CppModuleConfiguration::hasValidConfig ( )

Returns true iff this is a valid configuration that can be used to load and compile modules.

Definition at line 67 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().

Member Data Documentation

◆ m_c_inc

SetOncePath lldb_private::CppModuleConfiguration::m_c_inc
private

If valid, the include path to the C library (e.g. /usr/include).

Definition at line 46 of file CppModuleConfiguration.h.

Referenced by analyzeFile(), CppModuleConfiguration(), and hasValidConfig().

◆ m_imported_modules

std::vector<std::string> lldb_private::CppModuleConfiguration::m_imported_modules
private

Definition at line 51 of file CppModuleConfiguration.h.

Referenced by CppModuleConfiguration(), and GetImportedModules().

◆ m_include_dirs

std::vector<std::string> lldb_private::CppModuleConfiguration::m_include_dirs
private

Definition at line 50 of file CppModuleConfiguration.h.

Referenced by CppModuleConfiguration(), and GetIncludeDirs().

◆ m_resource_inc

std::string lldb_private::CppModuleConfiguration::m_resource_inc
private

The Clang resource include path for this configuration.

Definition at line 48 of file CppModuleConfiguration.h.

Referenced by CppModuleConfiguration().

◆ m_std_inc

SetOncePath lldb_private::CppModuleConfiguration::m_std_inc
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().


The documentation for this class was generated from the following files: