LLVM 24.0.0git
llvm::ToolSession Class Reference

Owns LLVM process initialization and an in-process tool registry. More...

#include "llvm/Support/Driver.h"

Classes

struct  Impl

Public Member Functions

 ToolSession (int &Argc, char **&Argv, ArrayRef< CallableTool > Tools, bool InstallPipeSignalExitHandler=true, bool NeedsPOSIXUtilitySignalHandling=false)
 ~ToolSession ()
 ToolSession (const ToolSession &)=delete
ToolSessionoperator= (const ToolSession &)=delete
ErrorOr< int > callTool (ArrayRef< const char * > Args)
 Invokes the tool named by Args[0].

Friends

class ToolContext

Detailed Description

Owns LLVM process initialization and an in-process tool registry.

A long-lived host constructs one session and uses it for every embedded tool invocation. The individual tools borrow a ToolContext and therefore do not initialize or shut down LLVM themselves.

LLVM tools may use process-global state. Tool invocations must be externally serialized; concurrent calls are not supported.

Definition at line 69 of file Driver.h.

Constructor & Destructor Documentation

◆ ToolSession() [1/2]

ToolSession::ToolSession ( int & Argc,
char **& Argv,
ArrayRef< CallableTool > Tools,
bool InstallPipeSignalExitHandler = true,
bool NeedsPOSIXUtilitySignalHandling = false )

Definition at line 58 of file Driver.cpp.

References assert().

Referenced by operator=(), and ToolSession().

◆ ~ToolSession()

ToolSession::~ToolSession ( )
default

◆ ToolSession() [2/2]

llvm::ToolSession::ToolSession ( const ToolSession & )
delete

References ToolSession().

Member Function Documentation

◆ callTool()

ErrorOr< int > ToolSession::callTool ( ArrayRef< const char * > Args)

Invokes the tool named by Args[0].

Args may instead contain a process-style argv beginning with the session executable or an LLVM multicall name.

Definition at line 95 of file Driver.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::ErrorOr< T >::getError(), llvm::make_error_code(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::sys::path::stem(), llvm::StringRef::str(), and ToolContext.

Referenced by operator=().

◆ operator=()

ToolSession & llvm::ToolSession::operator= ( const ToolSession & )
delete

◆ ToolContext

friend class ToolContext
friend

Definition at line 91 of file Driver.h.

References ToolContext.

Referenced by callTool(), operator=(), and ToolContext.


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