clang 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
clang::Interpreter Class Reference

Provides top-level interfaces for incremental compilation and execution. More...

#include "clang/Interpreter/Interpreter.h"

Public Types

enum  InterfaceKind { NoAlloc , WithAlloc , CopyArray , NewTag }
 

Public Member Functions

virtual ~Interpreter ()
 
const ASTContextgetASTContext () const
 
ASTContextgetASTContext ()
 
const CompilerInstancegetCompilerInstance () const
 
CompilerInstancegetCompilerInstance ()
 
llvm::Expected< llvm::orc::LLJIT & > getExecutionEngine ()
 
llvm::Expected< PartialTranslationUnit & > Parse (llvm::StringRef Code)
 
llvm::Error Execute (PartialTranslationUnit &T)
 
llvm::Error ParseAndExecute (llvm::StringRef Code, Value *V=nullptr)
 
llvm::Expected< llvm::orc::ExecutorAddr > CompileDtorCall (CXXRecordDecl *CXXRD)
 
llvm::Error Undo (unsigned N=1)
 Undo N previous incremental inputs.
 
llvm::Error LoadDynamicLibrary (const char *name)
 Link a dynamic library.
 
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress (GlobalDecl GD) const
 
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress (llvm::StringRef IRName) const
 
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddressFromLinkerName (llvm::StringRef LinkerName) const
 
const llvm::SmallVectorImpl< Expr * > & getValuePrintingInfo () const
 
ExprSynthesizeExpr (Expr *E)
 

Static Public Member Functions

static llvm::Expected< std::unique_ptr< Interpreter > > create (std::unique_ptr< CompilerInstance > CI)
 
static llvm::Expected< std::unique_ptr< Interpreter > > createWithCUDA (std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI)
 

Protected Member Functions

 Interpreter (std::unique_ptr< CompilerInstance > CI, llvm::Error &Err)
 
llvm::Error CreateExecutor ()
 
void ResetExecutor ()
 
virtual std::unique_ptr< RuntimeInterfaceBuilderFindRuntimeInterface ()
 
virtual llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > CreateJITBuilder (CompilerInstance &CI)
 

Detailed Description

Provides top-level interfaces for incremental compilation and execution.

Definition at line 91 of file Interpreter.h.

Member Enumeration Documentation

◆ InterfaceKind

Enumerator
NoAlloc 
WithAlloc 
CopyArray 
NewTag 

Definition at line 177 of file Interpreter.h.

Constructor & Destructor Documentation

◆ Interpreter()

Interpreter::Interpreter ( std::unique_ptr< CompilerInstance CI,
llvm::Error &  Err 
)
protected

Definition at line 231 of file Interpreter.cpp.

◆ ~Interpreter()

Interpreter::~Interpreter ( )
virtual

Definition at line 240 of file Interpreter.cpp.

References toString().

Member Function Documentation

◆ CompileDtorCall()

llvm::Expected< llvm::orc::ExecutorAddr > Interpreter::CompileDtorCall ( CXXRecordDecl CXXRD)

◆ create()

llvm::Expected< std::unique_ptr< Interpreter > > Interpreter::create ( std::unique_ptr< CompilerInstance CI)
static

Definition at line 276 of file Interpreter.cpp.

References Runtimes.

Referenced by createWithCUDA().

◆ CreateExecutor()

llvm::Error Interpreter::CreateExecutor ( )
protected

Definition at line 393 of file Interpreter.cpp.

References CreateJITBuilder(), and getCompilerInstance().

Referenced by Execute(), and getExecutionEngine().

◆ CreateJITBuilder()

llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > Interpreter::CreateJITBuilder ( CompilerInstance CI)
protectedvirtual

◆ createWithCUDA()

llvm::Expected< std::unique_ptr< Interpreter > > Interpreter::createWithCUDA ( std::unique_ptr< CompilerInstance CI,
std::unique_ptr< CompilerInstance DCI 
)
static

Definition at line 295 of file Interpreter.cpp.

References create().

◆ Execute()

llvm::Error Interpreter::Execute ( PartialTranslationUnit T)

Definition at line 412 of file Interpreter.cpp.

References CreateExecutor(), and clang::T.

Referenced by ParseAndExecute().

◆ FindRuntimeInterface()

std::unique_ptr< RuntimeInterfaceBuilder > Interpreter::FindRuntimeInterface ( )
protectedvirtual

◆ getASTContext() [1/2]

ASTContext & Interpreter::getASTContext ( )

◆ getASTContext() [2/2]

const ASTContext & Interpreter::getASTContext ( ) const

◆ getCompilerInstance() [1/2]

CompilerInstance * Interpreter::getCompilerInstance ( )

Definition at line 326 of file Interpreter.cpp.

◆ getCompilerInstance() [2/2]

const CompilerInstance * Interpreter::getCompilerInstance ( ) const

◆ getExecutionEngine()

llvm::Expected< llvm::orc::LLJIT & > Interpreter::getExecutionEngine ( )

Definition at line 330 of file Interpreter.cpp.

References CreateExecutor().

Referenced by LoadDynamicLibrary().

◆ getSymbolAddress() [1/2]

llvm::Expected< llvm::orc::ExecutorAddr > Interpreter::getSymbolAddress ( GlobalDecl  GD) const
Returns
the ExecutorAddr of a GlobalDecl. This interface uses the CodeGenModule's internal mangling cache to avoid recomputing the mangled name.

Definition at line 449 of file Interpreter.cpp.

References getSymbolAddress().

Referenced by CompileDtorCall(), and getSymbolAddress().

◆ getSymbolAddress() [2/2]

llvm::Expected< llvm::orc::ExecutorAddr > Interpreter::getSymbolAddress ( llvm::StringRef  IRName) const
Returns
the ExecutorAddr of a given name as written in the IR.

Definition at line 459 of file Interpreter.cpp.

References clang::IncrementalExecutor::IRName.

◆ getSymbolAddressFromLinkerName()

llvm::Expected< llvm::orc::ExecutorAddr > Interpreter::getSymbolAddressFromLinkerName ( llvm::StringRef  LinkerName) const
Returns
the ExecutorAddr of a given name as written in the object file.

Definition at line 469 of file Interpreter.cpp.

References clang::IncrementalExecutor::LinkerName.

◆ getValuePrintingInfo()

const llvm::SmallVectorImpl< Expr * > & clang::Interpreter::getValuePrintingInfo ( ) const
inline

Definition at line 179 of file Interpreter.h.

◆ LoadDynamicLibrary()

llvm::Error Interpreter::LoadDynamicLibrary ( const char *  name)

Link a dynamic library.

Definition at line 497 of file Interpreter.cpp.

References getExecutionEngine().

◆ Parse()

llvm::Expected< PartialTranslationUnit & > Interpreter::Parse ( llvm::StringRef  Code)

◆ ParseAndExecute()

llvm::Error Interpreter::ParseAndExecute ( llvm::StringRef  Code,
Value V = nullptr 
)

◆ ResetExecutor()

void Interpreter::ResetExecutor ( )
protected

Definition at line 410 of file Interpreter.cpp.

◆ SynthesizeExpr()

Expr * Interpreter::SynthesizeExpr ( Expr E)

◆ Undo()

llvm::Error Interpreter::Undo ( unsigned  N = 1)

Undo N previous incremental inputs.

Definition at line 478 of file Interpreter.cpp.


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