clang 23.0.0git
clang::Interpreter Class Reference

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

#include "clang/Interpreter/Interpreter.h"

Public Member Functions

virtual ~Interpreter ()
const ASTContextgetASTContext () const
ASTContextgetASTContext ()
const CompilerInstancegetCompilerInstance () const
CompilerInstancegetCompilerInstance ()
llvm::Expected< IncrementalExecutor & > 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
const IncrementalExecutorBuildergetIncrementalExecutorBuilder () const

Static Public Member Functions

static llvm::Expected< std::unique_ptr< Interpreter > > create (std::unique_ptr< CompilerInstance > CI, std::unique_ptr< IncrementalExecutorBuilder > IEB=nullptr)
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 > Instance, llvm::Error &Err, std::unique_ptr< IncrementalExecutorBuilder > IEB=nullptr, std::unique_ptr< clang::ASTConsumer > Consumer=nullptr)
llvm::Error CreateExecutor ()
void ResetExecutor ()

Friends

class Value

Detailed Description

Provides top-level interfaces for incremental compilation and execution.

Definition at line 98 of file Interpreter.h.

Constructor & Destructor Documentation

◆ Interpreter()

clang::Interpreter::Interpreter ( std::unique_ptr< CompilerInstance > Instance,
llvm::Error & Err,
std::unique_ptr< IncrementalExecutorBuilder > IEB = nullptr,
std::unique_ptr< clang::ASTConsumer > Consumer = nullptr )
protected

Definition at line 250 of file Interpreter.cpp.

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

Referenced by create(), and getCompilerInstance().

◆ ~Interpreter()

clang::Interpreter::~Interpreter ( )
virtual

Definition at line 306 of file Interpreter.cpp.

References toString().

Member Function Documentation

◆ create()

llvm::Expected< std::unique_ptr< Interpreter > > clang::Interpreter::create ( std::unique_ptr< CompilerInstance > CI,
std::unique_ptr< IncrementalExecutorBuilder > IEB = nullptr )
static

Definition at line 350 of file Interpreter.cpp.

References Interpreter(), and clang::Runtimes.

Referenced by createWithCUDA().

◆ CreateExecutor()

llvm::Error clang::Interpreter::CreateExecutor ( )
protected

Definition at line 482 of file Interpreter.cpp.

Referenced by Execute(), getExecutionEngine(), and Interpreter().

◆ createWithCUDA()

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

Definition at line 371 of file Interpreter.cpp.

References create().

◆ Execute()

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

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

◆ getCompilerInstance() [2/2]

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

Definition at line 417 of file Interpreter.cpp.

References getCompilerInstance(), and Interpreter().

Referenced by getASTContext(), getASTContext(), getCompilerInstance(), and Parse().

◆ getExecutionEngine()

llvm::Expected< IncrementalExecutor & > clang::Interpreter::getExecutionEngine ( )

Definition at line 421 of file Interpreter.cpp.

References CreateExecutor().

Referenced by LoadDynamicLibrary().

◆ getIncrementalExecutorBuilder()

const IncrementalExecutorBuilder & clang::Interpreter::getIncrementalExecutorBuilder ( ) const
inline

Definition at line 183 of file Interpreter.h.

◆ 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 546 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 556 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 566 of file Interpreter.cpp.

References clang::IncrementalExecutor::LinkerName.

◆ LoadDynamicLibrary()

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

Link a dynamic library.

Definition at line 601 of file Interpreter.cpp.

References getExecutionEngine().

◆ Parse()

◆ ParseAndExecute()

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

Definition at line 526 of file Interpreter.cpp.

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

◆ ResetExecutor()

void clang::Interpreter::ResetExecutor ( )
inlineprotected

Definition at line 142 of file Interpreter.h.

◆ Undo()

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

Undo N previous incremental inputs.

Definition at line 575 of file Interpreter.cpp.

◆ Value

friend class Value
friend

Definition at line 99 of file Interpreter.h.

References Value.

Referenced by ParseAndExecute(), and Value.


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