@@ -89,6 +89,43 @@ public struct Function: ValueRef {
8989 public init ( llvm: LLVMValueRef ) {
9090 self . llvm = llvm
9191 }
92+
93+ /// Get the number of basic blocks for current function
94+ public var countBasicBlocks : UInt32 {
95+ BasicBlock . countBasicBlocks ( funcValueRef: self )
96+ }
97+
98+ /// Get all of the basic blocks in the current function.
99+ public var getBasicBlocks : [ BasicBlockRef ] {
100+ BasicBlock . getBasicBlocks ( funcValueRef: self )
101+ }
102+
103+ /// Get the first basic block for current function.
104+ public var getFirstBasicBlock : BasicBlockRef ? {
105+ BasicBlock . getFirstBasicBlock ( funcValueRef: self )
106+ }
107+
108+ /// Get the last basic block for current function.
109+ public var getLastBasicBlock : BasicBlockRef ? {
110+ BasicBlock . getLastBasicBlock ( funcValueRef: self )
111+ }
112+
113+ /// Get the basic block that corresponds to the entry point of the current function.
114+ public var getEntryBasicBlock : BasicBlockRef ? { BasicBlock . getEntryBasicBlock ( funcValueRef: self ) }
115+
116+ /// Append the given basic block to the basic block list for the current function.
117+ public func appendExistingBasicBlock( funcValueRef: ValueRef , blockRef: BasicBlockRef ) { BasicBlock . appendExistingBasicBlock ( funcValueRef: self , blockRef: blockRef)
118+ }
119+
120+ /// Append named basic block to the end of a function in Context.
121+ /// Return BasicBlock
122+ public func appendBasicBlockInContext( contextRef: ContextRef , blockName: String ) -> BasicBlockRef { BasicBlock . appendBasicBlockInContext ( contextRef: contextRef, funcValueRef: self , blockName: blockName)
123+ }
124+
125+ /// Append named basic block to the end of the current function using the global context.
126+ /// Return BasicBlock
127+ public func appendBasicBlock( blockName: String ) -> BasicBlockRef { BasicBlock . appendBasicBlock ( funcValueRef: self , blockName: blockName)
128+ }
92129}
93130
94131extension Function : Equatable {
0 commit comments