LLDB  mainline
Classes | Functions
CxxModuleHandler.cpp File Reference
#include "Plugins/ExpressionParser/Clang/CxxModuleHandler.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Utility/Log.h"
#include "clang/Sema/Lookup.h"
#include "llvm/Support/Error.h"
Include dependency graph for CxxModuleHandler.cpp:

Go to the source code of this file.

Classes

struct  MissingDeclContext
 Error class for handling problems when finding a certain DeclContext. More...
 

Functions

static void makeScopes (Sema &sema, DeclContext *ctxt, std::vector< Scope *> &result)
 Builds a list of scopes that point into the given context. More...
 
static std::unique_ptr< LookupResult > emulateLookupInCtxt (Sema &sema, llvm::StringRef name, DeclContext *ctxt)
 Uses the Sema to look up the given name in the given DeclContext. More...
 
static llvm::Expected< DeclContext * > getEqualLocalDeclContext (Sema &sema, DeclContext *foreign_ctxt)
 Given a foreign decl context, this function finds the equivalent local decl context in the ASTContext of the given Sema. More...
 
static bool templateArgsAreSupported (ArrayRef< TemplateArgument > a)
 Returns true iff tryInstantiateStdTemplate supports instantiating a template with the given template arguments. More...
 
template<typename T , typename... Args>
T * createDecl (ASTImporter &importer, Decl *from_d, Args &&... args)
 Constructor function for Clang declarations. More...
 

Function Documentation

◆ createDecl()

template<typename T , typename... Args>
T* createDecl ( ASTImporter &  importer,
Decl *  from_d,
Args &&...  args 
)

Constructor function for Clang declarations.

Ensures that the created declaration is registered with the ASTImporter.

Definition at line 171 of file CxxModuleHandler.cpp.

◆ emulateLookupInCtxt()

static std::unique_ptr<LookupResult> emulateLookupInCtxt ( Sema &  sema,
llvm::StringRef  name,
DeclContext *  ctxt 
)
static

Uses the Sema to look up the given name in the given DeclContext.

Definition at line 65 of file CxxModuleHandler.cpp.

References makeScopes().

Referenced by getEqualLocalDeclContext(), and lldb_private::CxxModuleHandler::tryInstantiateStdTemplate().

◆ getEqualLocalDeclContext()

static llvm::Expected<DeclContext *> getEqualLocalDeclContext ( Sema &  sema,
DeclContext *  foreign_ctxt 
)
static

Given a foreign decl context, this function finds the equivalent local decl context in the ASTContext of the given Sema.

Potentially deserializes decls from the 'std' module if necessary.

Definition at line 118 of file CxxModuleHandler.cpp.

References emulateLookupInCtxt().

Referenced by lldb_private::CxxModuleHandler::tryInstantiateStdTemplate().

◆ makeScopes()

static void makeScopes ( Sema &  sema,
DeclContext *  ctxt,
std::vector< Scope *> &  result 
)
static

Builds a list of scopes that point into the given context.

Parameters
semaThe sema that will be using the scopes.
ctxtThe context that the scope should look into.
resultA list of scopes. The scopes need to be freed by the caller (except the TUScope which is owned by the sema).

Definition at line 47 of file CxxModuleHandler.cpp.

Referenced by emulateLookupInCtxt().

◆ templateArgsAreSupported()

static bool templateArgsAreSupported ( ArrayRef< TemplateArgument >  a)
static

Returns true iff tryInstantiateStdTemplate supports instantiating a template with the given template arguments.

Definition at line 154 of file CxxModuleHandler.cpp.

Referenced by lldb_private::CxxModuleHandler::tryInstantiateStdTemplate().