clang 22.0.0git
clang::Interpreter Class Reference

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

#include "clang/Interpreter/Interpreter.h"

Classes

struct  JITConfig

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::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
uint32_t getOutOfProcessExecutorPID () const

Static Public Member Functions

static llvm::Expected< std::unique_ptr< Interpreter > > create (std::unique_ptr< CompilerInstance > CI, JITConfig Config={})
static llvm::Expected< std::unique_ptr< Interpreter > > createWithCUDA (std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI)
static llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > createLLJITBuilder (std::unique_ptr< llvm::orc::ExecutorProcessControl > EPC, llvm::StringRef OrcRuntimePath)
static llvm::Expected< std::pair< std::unique_ptr< llvm::orc::LLJITBuilder >, uint32_t > > outOfProcessJITBuilder (JITConfig Config)
static llvm::Expected< std::string > getOrcRuntimePath (const driver::ToolChain &TC)

Protected Member Functions

 Interpreter (std::unique_ptr< CompilerInstance > Instance, llvm::Error &Err, std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder=nullptr, std::unique_ptr< clang::ASTConsumer > Consumer=nullptr, JITConfig Config=JITConfig())
llvm::Error CreateExecutor (JITConfig Config=JITConfig())
void ResetExecutor ()

Friends

class Value

Detailed Description

Provides top-level interfaces for incremental compilation and execution.

Definition at line 91 of file Interpreter.h.

Constructor & Destructor Documentation

◆ Interpreter()

clang::Interpreter::Interpreter ( std::unique_ptr< CompilerInstance > Instance,
llvm::Error & Err,
std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder = nullptr,
std::unique_ptr< clang::ASTConsumer > Consumer = nullptr,
JITConfig Config = JITConfig() )
protected

Definition at line 251 of file Interpreter.cpp.

References clang::C, CreateExecutor(), and Execute().

Referenced by create(), and getCompilerInstance().

◆ ~Interpreter()

clang::Interpreter::~Interpreter ( )
virtual

Definition at line 307 of file Interpreter.cpp.

References toString().

Member Function Documentation

◆ create()

llvm::Expected< std::unique_ptr< Interpreter > > clang::Interpreter::create ( std::unique_ptr< CompilerInstance > CI,
JITConfig Config = {} )
static

◆ CreateExecutor()

◆ createLLJITBuilder()

llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > clang::Interpreter::createLLJITBuilder ( std::unique_ptr< llvm::orc::ExecutorProcessControl > EPC,
llvm::StringRef OrcRuntimePath )
static

◆ createWithCUDA()

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

Definition at line 469 of file Interpreter.cpp.

References create().

◆ Execute()

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

Definition at line 678 of file Interpreter.cpp.

References CreateExecutor(), and clang::T.

Referenced by Interpreter(), and ParseAndExecute().

◆ getASTContext() [1/2]

ASTContext & clang::Interpreter::getASTContext ( )

◆ getASTContext() [2/2]

const ASTContext & clang::Interpreter::getASTContext ( ) const

◆ getCompilerInstance() [1/2]

CompilerInstance * clang::Interpreter::getCompilerInstance ( )

Definition at line 513 of file Interpreter.cpp.

◆ getCompilerInstance() [2/2]

const CompilerInstance * clang::Interpreter::getCompilerInstance ( ) const

◆ getExecutionEngine()

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

Definition at line 518 of file Interpreter.cpp.

References CreateExecutor().

Referenced by LoadDynamicLibrary().

◆ getOrcRuntimePath()

llvm::Expected< std::string > clang::Interpreter::getOrcRuntimePath ( const driver::ToolChain & TC)
static

◆ getOutOfProcessExecutorPID()

uint32_t clang::Interpreter::getOutOfProcessExecutorPID ( ) const

Definition at line 545 of file Interpreter.cpp.

◆ getSymbolAddress() [1/2]

llvm::Expected< llvm::orc::ExecutorAddr > clang::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 722 of file Interpreter.cpp.

References getSymbolAddress().

Referenced by getSymbolAddress().

◆ getSymbolAddress() [2/2]

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

Definition at line 732 of file Interpreter.cpp.

References clang::IncrementalExecutor::IRName.

◆ getSymbolAddressFromLinkerName()

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

Definition at line 742 of file Interpreter.cpp.

References clang::IncrementalExecutor::LinkerName.

◆ LoadDynamicLibrary()

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

Link a dynamic library.

Definition at line 777 of file Interpreter.cpp.

References getExecutionEngine().

◆ outOfProcessJITBuilder()

◆ Parse()

◆ ParseAndExecute()

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

Definition at line 702 of file Interpreter.cpp.

References Execute(), clang::Parse, V, and Value.

◆ ResetExecutor()

void clang::Interpreter::ResetExecutor ( )
protected

Definition at line 676 of file Interpreter.cpp.

◆ Undo()

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

Undo N previous incremental inputs.

Definition at line 751 of file Interpreter.cpp.

◆ Value

friend class Value
friend

Definition at line 92 of file Interpreter.h.

References Value.

Referenced by ParseAndExecute(), and Value.


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