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, std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder=nullptr)
 
llvm::Error CreateExecutor ()
 
void ResetExecutor ()
 
virtual std::unique_ptr< RuntimeInterfaceBuilderFindRuntimeInterface ()
 

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 170 of file Interpreter.h.

Constructor & Destructor Documentation

◆ Interpreter()

Interpreter::Interpreter ( std::unique_ptr< CompilerInstance CI,
llvm::Error &  Err,
std::unique_ptr< llvm::orc::LLJITBuilder >  JITBuilder = nullptr 
)
protected

Definition at line 234 of file Interpreter.cpp.

References CreateExecutor(), and Execute().

◆ ~Interpreter()

Interpreter::~Interpreter ( )
virtual

Definition at line 263 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 299 of file Interpreter.cpp.

References Runtimes.

Referenced by createWithCUDA().

◆ CreateExecutor()

llvm::Error Interpreter::CreateExecutor ( )
protected

◆ createWithCUDA()

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

Definition at line 318 of file Interpreter.cpp.

References create().

◆ Execute()

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

Definition at line 439 of file Interpreter.cpp.

References CreateExecutor(), and clang::T.

Referenced by Interpreter(), and 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 349 of file Interpreter.cpp.

◆ getCompilerInstance() [2/2]

const CompilerInstance * Interpreter::getCompilerInstance ( ) const

◆ getExecutionEngine()

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

Definition at line 353 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 476 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 486 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 496 of file Interpreter.cpp.

References clang::IncrementalExecutor::LinkerName.

◆ getValuePrintingInfo()

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

Definition at line 172 of file Interpreter.h.

◆ LoadDynamicLibrary()

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

Link a dynamic library.

Definition at line 524 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 437 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 505 of file Interpreter.cpp.


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