LLVM API Documentation

Modules | Typedefs | Functions
Core
LLVM-C: C interface to LLVM
Collaboration diagram for Core:

Modules

 Types and Enumerations
 Contexts
 Modules
 Types
 Values
 Metadata
 Basic Block
 Instructions

Typedefs

typedef void(* LLVMFatalErrorHandler )(const char *Reason)

Functions

void LLVMInitializeCore (LLVMPassRegistryRef R)
void LLVMShutdown (void)
char * LLVMCreateMessage (const char *Message)
void LLVMDisposeMessage (char *Message)
void LLVMInstallFatalErrorHandler (LLVMFatalErrorHandler Handler)
void LLVMResetFatalErrorHandler (void)
void LLVMEnablePrettyStackTrace (void)

Detailed Description

This modules provide an interface to libLLVMCore, which implements the LLVM intermediate representation as well as other related types and utilities.

LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed as base types. Despite the declared types, most of the functions provided operate only on branches of the type hierarchy. The declared parameter names are descriptive and specify which type is required. Additionally, each type hierarchy is documented along with the functions that operate upon it. For more detail, refer to LLVM's C++ code. If in doubt, refer to Core.cpp, which performs parameter downcasts in the form unwrap<RequiredType>(Param).

Many exotic languages can interoperate with C code but have a harder time with C++ due to name mangling. So in addition to C, this interface enables tools written in such languages.


Typedef Documentation

typedef void(* LLVMFatalErrorHandler)(const char *Reason)

Definition at line 433 of file Core.h.


Function Documentation

char* LLVMCreateMessage ( const char *  Message)

Definition at line 64 of file Core.cpp.

References llvm::LibFunc::strdup.

Referenced by LLVMGetDiagInfoDescription().

void LLVMDisposeMessage ( char *  Message)

Definition at line 68 of file Core.cpp.

References llvm::LibFunc::free.

void LLVMEnablePrettyStackTrace ( void  )

Enable LLVM's built-in stack trace code. This intercepts the OS's crash signals and prints which component of LLVM you were in at the time if the crash.

Definition at line 149 of file PrettyStackTrace.cpp.

References llvm::EnablePrettyStackTrace().

Definition at line 54 of file Core.cpp.

Install a fatal error handler. By default, if LLVM detects a fatal error, it will call exit(1). This may not be appropriate in many contexts. For example, doing exit(1) will bypass many crash reporting/tracing system tools. This function allows you to install a callback that will be invoked prior to the call to exit(1).

Definition at line 114 of file ErrorHandling.cpp.

References bindingsErrorHandler(), llvm::install_fatal_error_handler(), and LLVM_EXTENSION.

void LLVMResetFatalErrorHandler ( void  )

Reset the fatal error handler. This resets LLVM's fatal error handling behavior to the default.

Definition at line 119 of file ErrorHandling.cpp.

References llvm::remove_fatal_error_handler().

void LLVMShutdown ( void  )

Deallocate and destroy all ManagedStatic variables.

See also:
llvm::llvm_shutdown
ManagedStatic

Definition at line 58 of file Core.cpp.

References llvm::llvm_shutdown().