LLVM API Documentation

llvm::sys Namespace Reference


Classes

class  DynamicLibrary
class  MemoryBlock
 Memory block abstraction. More...
class  Memory
 An abstraction for memory operations. More...
class  MutexImpl
 Platform agnostic Mutex class. More...
class  SmartMutex
class  SmartScopedLock
class  FileStatus
 File status structure. More...
class  Path
 An abstraction for operating system paths. More...
class  PathWithStatus
 Path with file status class. More...
class  Process
 An abstraction for operating system processes. More...
class  Program
 An abstraction for finding and executing programs. More...
class  RWMutexImpl
 Platform agnostic RWMutex class. More...
class  SmartRWMutex
struct  SmartScopedReader
 ScopedReader - RAII acquisition of a reader lock. More...
struct  SmartScopedWriter
 ScopedWriter - RAII acquisition of a writer lock. More...
class  ThreadLocalImpl
class  ThreadLocal
class  TimeValue
 Provides an abstraction for a fixed point in time. More...

Typedefs

typedef uint32_t cas_flag
typedef SmartMutex< false > Mutex
 Mutex - A standard, always enforced mutex.
typedef SmartScopedLock< false > ScopedLock
typedef SmartRWMutex< false > RWMutex
typedef SmartScopedReader< false > ScopedReader
typedef SmartScopedWriter< false > ScopedWriter

Enumerations

enum  LLVMFileType {
  Unknown_FileType = 0, Bitcode_FileType, Archive_FileType, ELF_Relocatable_FileType,
  ELF_Executable_FileType, ELF_SharedObject_FileType, ELF_Core_FileType, Mach_O_Object_FileType,
  Mach_O_Executable_FileType, Mach_O_FixedVirtualMemorySharedLib_FileType, Mach_O_Core_FileType, Mach_O_PreloadExectuable_FileType,
  Mach_O_DynamicallyLinkedSharedLib_FileType, Mach_O_DynamicLinker_FileType, Mach_O_Bundle_FileType, Mach_O_DynamicallyLinkedSharedLibStub_FileType,
  COFF_FileType
}
 This enumeration delineates the kinds of files that LLVM knows about. More...

Functions

void SetupAlarm (unsigned seconds)
void TerminateAlarm ()
int AlarmStatus ()
void Sleep (unsigned n)
void MemoryFence ()
cas_flag CompareAndSwap (volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
cas_flag AtomicIncrement (volatile cas_flag *ptr)
cas_flag AtomicDecrement (volatile cas_flag *ptr)
cas_flag AtomicAdd (volatile cas_flag *ptr, cas_flag val)
cas_flag AtomicMul (volatile cas_flag *ptr, cas_flag val)
cas_flag AtomicDiv (volatile cas_flag *ptr, cas_flag val)
bool hasDisassembler ()
std::string disassembleBuffer (uint8_t *start, size_t length, uint64_t pc=0)
std::string StrError ()
std::string StrError (int errnum)
 Like the no-argument version above, but uses errnum instead of errno.
bool isLittleEndianHost ()
bool isBigEndianHost ()
std::string getHostTriple ()
LLVMFileType IdentifyFileType (const char *magic, unsigned length)
bool CopyFile (const Path &Dest, const Path &Src, std::string *ErrMsg)
 Copy one file to another.
bool RemoveFileOnSignal (const Path &Filename, std::string *ErrMsg=0)
 Remove a file if a fatal signal occurs.
void PrintStackTraceOnErrorSignal ()
 Print a stack trace if a fatal signal occurs.
void AddSignalHandler (void(*FnPtr)(void *), void *Cookie)
void SetInterruptFunction (void(*IF)())
 Register a function to be called when ctrl-c is pressed.
TimeValue operator+ (const TimeValue &tv1, const TimeValue &tv2)
TimeValue operator- (const TimeValue &tv1, const TimeValue &tv2)

Variables

const char PathSeparator


Typedef Documentation

typedef uint32_t llvm::sys::cas_flag

Definition at line 23 of file Atomic.h.

typedef SmartMutex<false> llvm::sys::Mutex

Mutex - A standard, always enforced mutex.

Definition at line 130 of file Mutex.h.

Definition at line 139 of file RWMutex.h.

Definition at line 146 of file Mutex.h.

Definition at line 154 of file RWMutex.h.

Definition at line 169 of file RWMutex.h.


Enumeration Type Documentation

This enumeration delineates the kinds of files that LLVM knows about.

Enumerator:
Unknown_FileType  Unrecognized file.
Bitcode_FileType  Bitcode file.
Archive_FileType  ar style archive file
ELF_Relocatable_FileType  ELF Relocatable object file.
ELF_Executable_FileType  ELF Executable image.
ELF_SharedObject_FileType  ELF dynamically linked shared lib.
ELF_Core_FileType  ELF core image.
Mach_O_Object_FileType  Mach-O Object file.
Mach_O_Executable_FileType  Mach-O Executable.
Mach_O_FixedVirtualMemorySharedLib_FileType  Mach-O Shared Lib, FVM.
Mach_O_Core_FileType  Mach-O Core File.
Mach_O_PreloadExectuable_FileType  Mach-O Preloaded Executable.
Mach_O_DynamicallyLinkedSharedLib_FileType  Mach-O dynlinked shared lib.
Mach_O_DynamicLinker_FileType  The Mach-O dynamic linker.
Mach_O_Bundle_FileType  Mach-O Bundle file.
Mach_O_DynamicallyLinkedSharedLibStub_FileType  Mach-O Shared lib stub.
COFF_FileType  COFF object file or lib.

Definition at line 684 of file Path.h.


Function Documentation

void llvm::sys::AddSignalHandler ( void(*)(void *)  FnPtr,
void *  Cookie 
)

AddSignalHandler - Add a function to be called when an abort/kill signal is delivered to the process. The handler can have a cookie passed to it to identify what instance of the handler it is.

Referenced by RegisterCrashPrinter().

int llvm::sys::AlarmStatus (  ) 

This function acquires the status of the alarm.

Returns:
-1=cancelled, 0=untriggered, 1=triggered

Referenced by llvm::SlowOperationInformer::progress().

cas_flag llvm::sys::AtomicAdd ( volatile cas_flag *  ptr,
cas_flag  val 
)

cas_flag llvm::sys::AtomicDecrement ( volatile cas_flag *  ptr  ) 

cas_flag llvm::sys::AtomicDiv ( volatile cas_flag *  ptr,
cas_flag  val 
)

cas_flag llvm::sys::AtomicIncrement ( volatile cas_flag *  ptr  ) 

cas_flag llvm::sys::AtomicMul ( volatile cas_flag *  ptr,
cas_flag  val 
)

cas_flag llvm::sys::CompareAndSwap ( volatile cas_flag *  ptr,
cas_flag  new_value,
cas_flag  old_value 
)

bool llvm::sys::CopyFile ( const Path &  Dest,
const Path &  Src,
std::string *  ErrMsg 
)

Copy one file to another.

This function can be used to copy the file specified by Src to the file specified by Dest. If an error occurs, Dest is removed.

Returns:
true if an error occurs, false otherwise

std::string llvm::sys::disassembleBuffer ( uint8_t *  start,
size_t  length,
uint64_t  pc = 0 
)

This function provides some "glue" code to call external disassembler libraries.

Definition at line 43 of file Disassembler.cpp.

std::string llvm::sys::getHostTriple (  ) 

getHostTriple() - Return the target triple of the running system.

The target triple is a string in the format of: CPU_TYPE-VENDOR-OPERATING_SYSTEM or CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM

Referenced by llvm::TargetRegistry::getClosestTargetForJIT(), and llvm::JIT::selectTarget().

bool llvm::sys::hasDisassembler (  ) 

This function returns true, if there is possible to use some external disassembler library. False otherwise.

Definition at line 29 of file Disassembler.cpp.

LLVMFileType llvm::sys::IdentifyFileType ( const char *  magic,
unsigned  length 
)

bool llvm::sys::isBigEndianHost (  )  [inline]

Definition at line 31 of file Host.h.

References isLittleEndianHost().

bool llvm::sys::isLittleEndianHost (  )  [inline]

void llvm::sys::MemoryFence (  ) 

TimeValue llvm::sys::operator+ ( const TimeValue &  tv1,
const TimeValue &  tv2 
) [inline]

Adds two TimeValue objects together.

Returns:
The sum of the two operands as a new TimeValue

Definition at line 367 of file TimeValue.h.

References llvm::sys::TimeValue::nanos_, llvm::sys::TimeValue::normalize(), and llvm::sys::TimeValue::seconds_.

TimeValue llvm::sys::operator- ( const TimeValue &  tv1,
const TimeValue &  tv2 
) [inline]

Subtracts two TimeValue objects.

Returns:
The difference of the two operands as a new TimeValue

Definition at line 373 of file TimeValue.h.

References llvm::sys::TimeValue::nanos_, llvm::sys::TimeValue::normalize(), and llvm::sys::TimeValue::seconds_.

void llvm::sys::PrintStackTraceOnErrorSignal (  ) 

Print a stack trace if a fatal signal occurs.

When an error signal (such as SIBABRT or SIGSEGV) is delivered to the process, print a stack trace and then exit.

bool llvm::sys::RemoveFileOnSignal ( const Path &  Filename,
std::string *  ErrMsg = 0 
)

Remove a file if a fatal signal occurs.

This function registers signal handlers to ensure that if a signal gets delivered that the named file is removed.

Referenced by llvm::Archive::writeToDisk().

void llvm::sys::SetInterruptFunction ( void(*)()  IF  ) 

Register a function to be called when ctrl-c is pressed.

This function registers a function to be called when the user "interrupts" the program (typically by pressing ctrl-c). When the user interrupts the program, the specified interrupt function is called instead of the program being killed, and the interrupt function automatically disabled. Note that interrupt functions are not allowed to call any non-reentrant functions. An null interrupt function pointer disables the current installed function. Note also that the handler may be executed on a different thread on some platforms.

void llvm::sys::SetupAlarm ( unsigned  seconds  ) 

This function registers an alarm to trigger some number of seconds in the future. When that time arrives, the AlarmStatus function will begin to return 1 instead of 0. The user must poll the status of the alarm by making occasional calls to AlarmStatus. If the user sends an interrupt signal, AlarmStatus will begin returning -1, even if the alarm event occurred.

Returns:
nothing
Parameters:
seconds  Number of seconds in future when alarm arrives

Referenced by llvm::SlowOperationInformer::SlowOperationInformer().

void llvm::sys::Sleep ( unsigned  n  ) 

Sleep for n seconds. Warning: mixing calls to Sleep() and other *Alarm calls may be a bad idea on some platforms (source: Linux man page).

Returns:
nothing.

std::string llvm::sys::StrError ( int  errnum  ) 

Like the no-argument version above, but uses errnum instead of errno.

Definition at line 38 of file Errno.cpp.

std::string llvm::sys::StrError (  ) 

Returns a string representation of the errno value, using whatever thread-safe variant of strerror() is available. Be sure to call this immediately after the function that set errno, or errno may have been overwritten by an intervening call.

Definition at line 33 of file Errno.cpp.

Referenced by MakeErrMsg().

void llvm::sys::TerminateAlarm (  ) 

This function terminates the alarm previously set up

Returns:
nothing

Referenced by llvm::SlowOperationInformer::~SlowOperationInformer().


Variable Documentation

This is the OS-specific path separator: a colon on Unix or a semicolon on Windows.

Referenced by getPathList().