LLVM API Documentation

llvm::sys Namespace Reference


Classes

class  DynamicLibrary
 Portable dynamic library abstraction. More...
class  MappedFile
 An abstraction for memory mapped files. More...
class  MemoryBlock
 Memory block abstraction. More...
class  Memory
 An abstraction for memory operations. More...
class  Mutex
 Platform agnostic Mutex class. More...
class  Path
 An abstraction for operating system paths. More...
class  Process
 An abstraction for operating system processes. More...
class  Program
 An abstraction for finding and executing programs. More...
class  TimeValue
 Provides an abstraction for a fixed point in time. More...

Enumerations

enum  LLVMFileType { UnknownFileType = 0, BytecodeFileType = 1, CompressedBytecodeFileType = 2, ArchiveFileType = 3 }
 This enumeration delineates the kinds of files that LLVM knows about. More...

Functions

void SetupAlarm (unsigned seconds)
void TerminateAlarm ()
int AlarmStatus ()
LLVMFileType IdentifyFileType (const char *magic, unsigned length)
void CopyFile (const Path &Dest, const Path &Src)
 Copy one file to another.
void RemoveFileOnSignal (const Path &Filename)
 Remove a file if a fatal signal occurs.
void RemoveDirectoryOnSignal (const Path &path)
 Remove a directory if a fatal signal occurs.
void PrintStackTraceOnErrorSignal ()
 Print a stack trace if a fatal signal occurs.
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)


Enumeration Type Documentation

enum llvm::sys::LLVMFileType

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

Enumerator:
UnknownFileType  Unrecognized file.
BytecodeFileType  Uncompressed bytecode file.
CompressedBytecodeFileType  Compressed bytecode file.
ArchiveFileType  ar style archive file

Definition at line 553 of file Path.h.


Function Documentation

int llvm::sys::AlarmStatus (  ) 

This function acquires the status of the alarm.

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

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

void llvm::sys::CopyFile ( const Path &  Dest,
const Path &  Src 
)

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.

Exceptions:
std::string if an error opening or writing the files occurs.

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

This utility function allows any memory block to be examined in order to determine its file type.

Definition at line 42 of file Path.cpp.

References ArchiveFileType, BytecodeFileType, CompressedBytecodeFileType, and UnknownFileType.

Referenced by llvm::Archive::addFileBefore(), llvm::Linker::LinkInLibrary(), llvm::Archive::parseMemberHeader(), and llvm::ArchiveMember::replaceWith().

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 369 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 375 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.

void llvm::sys::RemoveDirectoryOnSignal ( const Path &  path  ) 

Remove a directory if a fatal signal occurs.

This function registers a signal handler to ensure that if a fatal signal gets delivered to the process that the named directory and all its contents are removed.

void llvm::sys::RemoveFileOnSignal ( const Path &  Filename  ) 

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::TerminateAlarm (  ) 

This function terminates the alarm previously set up

Returns:
nothing

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