LLDB  mainline
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lldb_private::ClangModulesDeclVendor Class Referenceabstract

#include <ClangModulesDeclVendor.h>

Inheritance diagram for lldb_private::ClangModulesDeclVendor:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::ClangModulesDeclVendor:
Collaboration graph
[legend]

Public Types

typedef std::vector< ConstStringModulePath
 
typedef uintptr_t ModuleID
 
typedef std::vector< ModuleIDModuleVector
 
- Public Types inherited from lldb_private::DeclVendor
enum  DeclVendorKind { eClangDeclVendor, eClangModuleDeclVendor, eAppleObjCDeclVendor, eLastClangDeclVendor }
 

Public Member Functions

 ClangModulesDeclVendor ()
 
 ~ClangModulesDeclVendor () override
 
virtual bool AddModule (const SourceModule &module, ModuleVector *exported_modules, Stream &error_stream)=0
 Add a module to the list of modules to search. More...
 
virtual bool AddModulesForCompileUnit (CompileUnit &cu, ModuleVector &exported_modules, Stream &error_stream)=0
 Add all modules referred to in a given compilation unit to the list of modules to search. More...
 
virtual void ForEachMacro (const ModuleVector &modules, std::function< bool(const std::string &)> handler)=0
 Enumerate all the macros that are defined by a given set of modules that are already imported. More...
 
- Public Member Functions inherited from lldb_private::ClangDeclVendor
 ClangDeclVendor (DeclVendorKind kind)
 
virtual ~ClangDeclVendor ()
 
uint32_t FindDecls (ConstString name, bool append, uint32_t max_matches, std::vector< clang::NamedDecl *> &decls)
 
- Public Member Functions inherited from lldb_private::DeclVendor
 DeclVendor (DeclVendorKind kind)
 
virtual ~DeclVendor ()
 
DeclVendorKind GetKind () const
 
virtual uint32_t FindDecls (ConstString name, bool append, uint32_t max_matches, std::vector< CompilerDecl > &decls)=0
 Look up the set of Decls that the DeclVendor currently knows about matching a given name. More...
 
std::vector< CompilerTypeFindTypes (ConstString name, uint32_t max_matches)
 Look up the types that the DeclVendor currently knows about matching a given name. More...
 

Static Public Member Functions

static bool classof (const DeclVendor *vendor)
 
static ClangModulesDeclVendorCreate (Target &target)
 
static bool LanguageSupportsClangModules (lldb::LanguageType language)
 Query whether Clang supports modules for a particular language. More...
 
- Static Public Member Functions inherited from lldb_private::ClangDeclVendor
static bool classof (const DeclVendor *vendor)
 

Detailed Description

Definition at line 22 of file ClangModulesDeclVendor.h.

Member Typedef Documentation

◆ ModuleID

Definition at line 36 of file ClangModulesDeclVendor.h.

◆ ModulePath

Definition at line 35 of file ClangModulesDeclVendor.h.

◆ ModuleVector

Definition at line 37 of file ClangModulesDeclVendor.h.

Constructor & Destructor Documentation

◆ ClangModulesDeclVendor()

ClangModulesDeclVendor::ClangModulesDeclVendor ( )

Definition at line 174 of file ClangModulesDeclVendor.cpp.

◆ ~ClangModulesDeclVendor()

ClangModulesDeclVendor::~ClangModulesDeclVendor ( )
override

Member Function Documentation

◆ AddModule()

virtual bool lldb_private::ClangModulesDeclVendor::AddModule ( const SourceModule module,
ModuleVector exported_modules,
Stream error_stream 
)
pure virtual

Add a module to the list of modules to search.

Parameters
[in]moduleThe path to the exact module to be loaded. E.g., if the desired module is std.io, then this should be { "std", "io" }.
[in]exported_modulesIf non-NULL, a pointer to a vector to populate with the ID of every module that is re-exported by the specified module.
[in]error_streamA stream to populate with the output of the Clang parser when it tries to load the module.
Returns
True if the module could be loaded; false if not. If the compiler encountered a fatal error during a previous module load, then this will always return false for this ModuleImporter.

Referenced by LanguageSupportsClangModules(), and lldb_private::ClangExpressionParser::LLDBPreprocessorCallbacks::moduleImport().

◆ AddModulesForCompileUnit()

virtual bool lldb_private::ClangModulesDeclVendor::AddModulesForCompileUnit ( CompileUnit cu,
ModuleVector exported_modules,
Stream error_stream 
)
pure virtual

Add all modules referred to in a given compilation unit to the list of modules to search.

Parameters
[in]cuThe compilation unit to scan for imported modules.
[in]exported_modulesA vector to populate with the ID of each module loaded (directly and via re-exports) in this way.
[in]error_streamA stream to populate with the output of the Clang parser when it tries to load the modules.
Returns
True if all modules referred to by the compilation unit could be loaded; false if one could not be loaded. If the compiler encountered a fatal error during a previous module load, then this will always return false for this ModuleImporter.

Referenced by lldb_private::ClangExpressionSourceCode::GetText(), and SetupDeclVendor().

◆ classof()

static bool lldb_private::ClangModulesDeclVendor::classof ( const DeclVendor vendor)
inlinestatic

◆ Create()

lldb_private::ClangModulesDeclVendor * ClangModulesDeclVendor::Create ( Target target)
static

◆ ForEachMacro()

virtual void lldb_private::ClangModulesDeclVendor::ForEachMacro ( const ModuleVector modules,
std::function< bool(const std::string &)>  handler 
)
pure virtual

Enumerate all the macros that are defined by a given set of modules that are already imported.

Parameters
[in]modulesThe unique IDs for all modules to query. Later modules have higher priority, just as if you them in that order. This matters if module A #defines a macro and module B #undefs it.
[in]handlerA function to call with the text of each #define (including the #define directive). #undef directives are not included; we simply elide any corresponding #define. If this function returns true, we stop the iteration immediately.

Referenced by lldb_private::ClangExpressionSourceCode::GetText().

◆ LanguageSupportsClangModules()

bool ClangModulesDeclVendor::LanguageSupportsClangModules ( lldb::LanguageType  language)
static

Query whether Clang supports modules for a particular language.

LLDB uses this to decide whether to try to find the modules loaded by a given compile unit.

Parameters
[in]languageThe language to query for.
Returns
True if Clang has modules for the given language.

Definition at line 353 of file ClangModulesDeclVendor.cpp.

References AddModule(), lldb::eLanguageTypeC, lldb::eLanguageTypeC11, lldb::eLanguageTypeC89, lldb::eLanguageTypeC99, lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeC_plus_plus_03, lldb::eLanguageTypeC_plus_plus_11, lldb::eLanguageTypeC_plus_plus_14, lldb::eLanguageTypeObjC, lldb::eLanguageTypeObjC_plus_plus, lldb_private::CompileUnit::GetImportedModules(), lldb_private::CompileUnit::GetLanguage(), lldb_private::ConstString::GetStringRef(), lldbassert, and lldb_private::Module.


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