Ensure uwtable is added to all generated functions.

This commit is contained in:
whitequark 2015-08-08 21:48:21 +03:00
parent 13ad9b5d08
commit 22457bc19c
1 changed files with 4 additions and 1 deletions

View File

@ -175,6 +175,7 @@ class LLVMIRGenerator:
def process_function(self, func):
try:
self.llfunction = self.llmodule.get_global(func.name)
if self.llfunction is None:
llargtys = []
for arg in func.arguments:
@ -182,10 +183,12 @@ class LLVMIRGenerator:
llfunty = ll.FunctionType(args=llargtys,
return_type=self.llty_of_type(func.type.ret, for_return=True))
self.llfunction = ll.Function(self.llmodule, llfunty, func.name)
self.llfunction.attributes.add('uwtable')
if func.is_internal:
self.llfunction.linkage = 'internal'
self.llfunction.attributes.add('uwtable')
self.llmap = {}
self.llbuilder = ll.IRBuilder()
self.fixups = []