clang 24.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 ASTContext & getASTContext () const
ASTContext & getASTContext ()
const CompilerInstance * getCompilerInstance () const
CompilerInstance * getCompilerInstance ()
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)
void setOptLevel (unsigned OptLevel, unsigned OptSize=0)
 Set the optimization level and size used to emit subsequently parsed input.
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 IncrementalExecutorBuilder & getIncrementalExecutorBuilder () 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 > > createWithDevice (std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI, OffloadType Type=OffloadType::Detect)

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 107 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 436 of file Interpreter.cpp.

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

Referenced by create(), and getCompilerInstance().

◆ ~Interpreter()

clang::Interpreter::~Interpreter ( )
virtual

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

References Interpreter(), and clang::Runtimes.

Referenced by createWithDevice().

◆ CreateExecutor()

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

◆ createWithDevice()

llvm::Expected< std::unique_ptr< Interpreter > > clang::Interpreter::createWithDevice ( std::unique_ptr< CompilerInstance > CI,
std::unique_ptr< CompilerInstance > DCI,
OffloadType Type = OffloadType::Detect )
static

Definition at line 573 of file Interpreter.cpp.

References create(), clang::Detect, and clang::HIP.

◆ Execute()

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

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

◆ getCompilerInstance() [2/2]

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

◆ getExecutionEngine()

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

Definition at line 639 of file Interpreter.cpp.

References CreateExecutor().

Referenced by LoadDynamicLibrary().

◆ getIncrementalExecutorBuilder()

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

Definition at line 198 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 783 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 793 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 803 of file Interpreter.cpp.

References clang::IncrementalExecutor::LinkerName.

◆ LoadDynamicLibrary()

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

Link a dynamic library.

Definition at line 838 of file Interpreter.cpp.

References getExecutionEngine().

◆ Parse()

◆ ParseAndExecute()

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

Definition at line 763 of file Interpreter.cpp.

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

◆ ResetExecutor()

void clang::Interpreter::ResetExecutor ( )
inlineprotected

Definition at line 151 of file Interpreter.h.

◆ setOptLevel()

void clang::Interpreter::setOptLevel ( unsigned OptLevel,
unsigned OptSize = 0 )

Set the optimization level and size used to emit subsequently parsed input.

OptSize mirrors CodeGenOptions::OptimizeSize (1 for -Os, 2 for -Oz).

Definition at line 648 of file Interpreter.cpp.

References clang::CompilerInstance::getCodeGenOpts(), getCompilerInstance(), clang::CodeGenOptions::NormalInlining, and clang::CodeGenOptions::OnlyAlwaysInlining.

◆ Undo()

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

Undo N previous incremental inputs.

Definition at line 812 of file Interpreter.cpp.

◆ Value

friend class Value
friend

Definition at line 108 of file Interpreter.h.

References Value.

Referenced by ParseAndExecute(), and Value.


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