clang 20.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
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< 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
 
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 > Instance, llvm::Error &Err, std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder=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 85 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 
)
protected

Definition at line 364 of file Interpreter.cpp.

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

◆ ~Interpreter()

clang::Interpreter::~Interpreter ( )
virtual

Definition at line 415 of file Interpreter.cpp.

References toString().

Member Function Documentation

◆ create()

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

Definition at line 450 of file Interpreter.cpp.

References clang::Runtimes.

◆ CreateExecutor()

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

Definition at line 583 of file Interpreter.cpp.

Referenced by 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 469 of file Interpreter.cpp.

◆ Execute()

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

Definition at line 618 of file Interpreter.cpp.

Referenced by Interpreter().

◆ getASTContext() [1/2]

ASTContext & clang::Interpreter::getASTContext ( )

Definition at line 511 of file Interpreter.cpp.

◆ getASTContext() [2/2]

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

Definition at line 515 of file Interpreter.cpp.

Referenced by clang::Value::getASTContext().

◆ getCompilerInstance() [1/2]

CompilerInstance * clang::Interpreter::getCompilerInstance ( )

Definition at line 500 of file Interpreter.cpp.

◆ getCompilerInstance() [2/2]

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

Definition at line 496 of file Interpreter.cpp.

◆ getExecutionEngine()

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

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

◆ 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 673 of file Interpreter.cpp.

◆ 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 683 of file Interpreter.cpp.

◆ getValuePrintingInfo()

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

Definition at line 166 of file Interpreter.h.

◆ LoadDynamicLibrary()

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

Link a dynamic library.

Definition at line 710 of file Interpreter.cpp.

◆ Parse()

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

Definition at line 552 of file Interpreter.cpp.

◆ ParseAndExecute()

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

Definition at line 643 of file Interpreter.cpp.

◆ ResetExecutor()

void clang::Interpreter::ResetExecutor ( )
protected

Definition at line 616 of file Interpreter.cpp.

◆ SynthesizeExpr()

Expr * clang::Interpreter::SynthesizeExpr ( Expr E)

◆ Undo()

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

Undo N previous incremental inputs.

Definition at line 692 of file Interpreter.cpp.

Friends And Related Function Documentation

◆ Value

friend class Value
friend

Definition at line 86 of file Interpreter.h.


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