LLDB mainline
Classes | Functions
CxxModuleHandler.cpp File Reference
#include "Plugins/ExpressionParser/Clang/CxxModuleHandler.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "clang/Sema/Lookup.h"
#include "llvm/Support/Error.h"
#include <optional>

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.
 
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.
 
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.
 
static bool templateArgsAreSupported (ArrayRef< TemplateArgument > a)
 Returns true iff tryInstantiateStdTemplate supports instantiating a template with the given template arguments.
 
template<typename T , typename... Args>
T * createDecl (ASTImporter &importer, Decl *from_d, Args &&... args)
 Constructor function for Clang declarations.
 

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 178 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 72 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 125 of file CxxModuleHandler.cpp.

References emulateLookupInCtxt(), and getEqualLocalDeclContext().

Referenced by getEqualLocalDeclContext(), and 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 54 of file CxxModuleHandler.cpp.

References makeScopes().

Referenced by emulateLookupInCtxt(), and makeScopes().

◆ templateArgsAreSupported()

static bool templateArgsAreSupported ( ArrayRef< TemplateArgument >  a)
static

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

Definition at line 161 of file CxxModuleHandler.cpp.

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