Allow retrieving argument attributes

This commit is contained in:
Siu Kwan Lam 2013-05-16 13:45:59 -05:00
commit 592f9c6988
3 changed files with 66 additions and 0 deletions

View file

@ -1283,6 +1283,24 @@ class TestTypeHash(TestCase):
tests.append(TestTypeHash)
# ---------------------------------------------------------------------------
class TestArgAttr(TestCase):
def test_arg_attr(self):
m = Module.new('oifjda')
vptr = Type.pointer(Type.float())
sptr = Type.pointer(Type.struct([]))
fnty = Type.function(Type.void(), [vptr] * 5)
func = m.add_function(fnty, 'foo')
attrs = [lc.ATTR_STRUCT_RET, lc.ATTR_BY_VAL, lc.ATTR_NEST,
lc.ATTR_NO_ALIAS, lc.ATTR_NO_CAPTURE]
for i, attr in enumerate(attrs):
arg = func.args[i]
self.assertEqual(i, arg.arg_no)
arg.add_attribute(attr)
self.assertTrue(attr in func.args[i])
tests.append(TestArgAttr)
# ---------------------------------------------------------------------------