Table of Contents

Method CreateFunction

Namespace
Ubiquity.NET.Llvm
Assembly
Ubiquity.NET.Llvm.dll

CreateFunction(LazyEncodedString, IFunctionType)

Gets an existing function with the specified signature in the module or creates a new one if it doesn't exist

Function CreateFunction(LazyEncodedString name, IFunctionType signature)

Parameters

name LazyEncodedString

Name of the function to add

signature IFunctionType

Signature of the function

Returns

Function

Functionmatching the specified signature and name

Remarks

If a matching function already exists it is returned, and therefore the returned Function may have a body and additional attributes. If a function of the same name exists with a different signature an exception is thrown as LLVM does not perform any function overloading.

CreateFunction(IDIBuilder, DIScope?, LazyEncodedString, LazyEncodedString?, DIFile?, uint, DebugFunctionType, bool, bool, uint, DebugInfoFlags, bool)

Creates a Function definition with Debug information

Function CreateFunction(IDIBuilder diBuilder, DIScope? scope, LazyEncodedString name, LazyEncodedString? linkageName, DIFile? file, uint line, DebugFunctionType signature, bool isLocalToUnit, bool isDefinition, uint scopeLine, DebugInfoFlags debugFlags, bool isOptimized)

Parameters

diBuilder IDIBuilder

The debug info builder to use to create the function (must be associated with this module)

scope DIScope

Containing scope for the function

name LazyEncodedString

Name of the function in source language form

linkageName LazyEncodedString

Mangled linker visible name of the function (may be same as name if mangling not required by source language

file DIFile

File containing the function definition

line uint

Line number of the function definition

signature DebugFunctionType

LLVM Function type for the signature of the function

isLocalToUnit bool

Flag to indicate if this function is local to the compilation unit

isDefinition bool

Flag to indicate if this is a definition

scopeLine uint

First line of the function's outermost scope, this may not be the same as the first line of the function definition due to source formatting

debugFlags DebugInfoFlags

Additional flags describing this function

isOptimized bool

Flag to indicate if this function is optimized

Returns

Function

Function described by the arguments

CreateFunction(IDIBuilder, LazyEncodedString, bool, IDebugType<ITypeRef, DIType>, params IEnumerable<IDebugType<ITypeRef, DIType>>)

Creates a function

Function CreateFunction(IDIBuilder diBuilder, LazyEncodedString name, bool isVarArg, IDebugType<ITypeRef, DIType> returnType, params IEnumerable<IDebugType<ITypeRef, DIType>> argumentTypes)

Parameters

diBuilder IDIBuilder

DIBuilder for creation of debug information

name LazyEncodedString

Name of the function

isVarArg bool

Flag indicating if the function supports a variadic argument list

returnType IDebugType<ITypeRef, DIType>

Return type of the function

argumentTypes IEnumerable<IDebugType<ITypeRef, DIType>>

Arguments for the function

Returns

Function

Function, matching the signature specified. This may be a previously declared or defined function or a new function if none matching the name and signature is already present.