Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d2f6975c3c
Fetching contributors…

Cannot retrieve contributors at this time

file 31 lines (25 sloc) 0.662 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#!/usr/bin/env python

from llvm.core import *
try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO


import unittest

def make_module():
    test_module = """
define i32 @sum(i32, i32) {
entry:
%2 = add i32 %0, %1
ret i32 %2
}
"""
    return Module.from_assembly(StringIO(test_module))

class TestAttr(unittest.TestCase):
    def test_align(self):
        m = make_module()
        f = m.get_function_named('sum')
        f.args[0].alignment = 16
        self.assertIn("align 16", str(f))
        self.assertEqual(f.args[0].alignment, 16)

if __name__ == '__main__':
    unittest.main()
Something went wrong with that request. Please try again.