Index: llvm/core.py
===================================================================
--- llvm/core.py (revision 85)
+++ llvm/core.py (working copy)
@@ -453,6 +453,10 @@
return _util.wrapiter(_core.LLVMGetFirstGlobal,
_core.LLVMGetNextGlobal, self.ptr, _make_value)
+ def add_alias(self, ty, val, name):
+ """Add a alias of val, with given type (of val) with given
name."""
+ return Alias.new(self, ty, val, name)
+
def add_function(self, ty, name):
"""Add a function of given type with given name."""
return Function.new(self, ty, name)
@@ -1252,6 +1256,13 @@
def set_alignment(self, align):
_core.LLVMSetParamAlignment(self.ptr, align)
+class Alias(GlobalValue):
+ @staticmethod
+ def new(module, ty, val, name):
+ check_is_module(module)
+ check_is_type(ty)
+ check_is_value(val)
+ return _core.LLVMAddAlias(module.ptr, ty.ptr, val.ptr, name)
class Function(GlobalValue):
Index: llvm/_core.c
===================================================================
--- llvm/_core.c (revision 85)
+++ llvm/_core.c (working copy)
@@ -495,6 +495,9 @@
_wrap_obj2obj(LLVMIsThreadLocal, LLVMValueRef, int)
_wrap_obj2obj(LLVMIsGlobalConstant, LLVMValueRef, int)
+/*===-- Aliases
--------------------------------------------------------===*/
+_wrap_objobjobjstr2obj(LLVMAddAlias, LLVMModuleRef, LLVMTypeRef,
LLVMValueRef, LLVMValueRef)
+
/*===-- Functions
--------------------------------------------------------===*/
_wrap_objstrobj2obj(LLVMAddFunction, LLVMModuleRef, LLVMTypeRef,
LLVMValueRef)
@@ -1318,6 +1321,9 @@
_method( LLVMIsThreadLocal )
_method( LLVMIsGlobalConstant )
+ /* Aliases */
+ _method( LLVMAddAlias )
+
/* Functions */
_method( LLVMAddFunction )
_method( LLVMGetNamedFunction )