On this page:
3.2.1.1 Types
3.2.1.2 Creating and Deleting Compiler Instances
3.2.1.3 Manipulating Compiliation Files and Flags
3.2.1.4 Error Reporting
3.2.1.5 Running the Compiler
3.0.10 (HEAD-8fd80004)
3.2.1 Compiler Support Library

Seashell’s compiler support library glues Seashell’s Racket sources with the infrastructure provided by LLVM and Clang.

Internal library developers should consult the documentation contained in /src/backend/compiler/compiler.cc

The following functions and types are exported for public use in Seashell’s Racket sources:

3.2.1.1 Types
3.2.1.2 Creating and Deleting Compiler Instances

const char*

 

seashell_clang_version

(

)

Returns the version of Clang that the library is linked against.

struct seashell_compiler*

 

seashell_compiler_make

(

)

Creates a new instance of the Seashell compiler.
Frees all resources allocated for a Seashell compiler instance.

3.2.1.3 Manipulating Compiliation Files and Flags

void

seashell_compiler_add_file

(

struct seashell_compiler* compiler,

 

 

const char* file)

Adds a source file to be compiled.

void

seashell_compiler_clear_files

(

struct seashell_compiler* compiler)

Clears the compiler’s list of files to compile.

void

seashell_compiler_add_compile_flag

(

struct seashell_compiler* compiler,

 

 

const char* flag)

Adds a compilation flag to the compiler.

void

seashell_compiler_clear_compile_flags

(

struct seashell_compiler* compiler)

Clears all compilation flags set for the compiler.

3.2.1.4 Error Reporting

const char*

seashell_compiler_get_linker_messages

(

struct seashell_compiler* compiler)

Gets any errors or warnings from the intermediate linkage step.
Note: The string returned is only valid while the compiler instance exists and until the next call of "seashell_compiler_run".

int

seashell_compiler_get_diagnostic_count

(

struct seashell_compiler* compiler,

 

 

int n)

Gets the number of compilation diagnostic messages available for the n’th file.

int

seashell_compiler_get_diagnostic_line

(

struct seashell_compiler* compiler,

 

 

int n,

 

 

int k)

Gets the line number of the k’th available diagnostic message for the n’th file.

int

seashell_compiler_get_diagnostic_column

(

struct seashell_compiler* compiler,

 

 

int n,

 

 

int k)

Gets the column number of the k’th available diagnostic message for the n’th file.

int

seashell_compiler_get_diagnostic_error

(

struct seashell_compiler* compiler,

 

 

int n,

 

 

int k)

Gets if the k’th available diagnostic for the n’th file is an error diagnostic.

const char*

seashell_compiler_get_diagnostic_file

(

struct seashell_compiler* compiler,

 

 

int n,

 

 

int k)

Gets file name for the k’th available diagnostic message for the n’th file.

const char*

seashell_compiler_get_diagnostic_message

(

struct seashell_compiler* compiler,

 

 

int n,

 

 

int k)

Gets the k’th available diagnostic message for the n’th file.

3.2.1.5 Running the Compiler

int

 

seashell_compiler_run

(

struct seashell_compiler* compiler)

Runs the Seashell compiler. Returns 0 on success, nonzero otherwise.

void*

seashell_compiler_get_object

(

struct seashell_compiler* compiler,

 

 

int* [OUT] length)

Returns a pointer to the resulting compiled object, if any. The length of the result is returned through the output argument length.