Expand Value class

This commit is contained in:
Siu Kwan Lam 2013-01-23 15:44:19 -06:00
commit a3da74c416
2 changed files with 21 additions and 1 deletions

View file

@ -2,7 +2,23 @@ from binding import *
from namespace import llvm
from raw_ostream import raw_ostream
from AssemblyAnnotationWriter import AssemblyAnnotationWriter
from Type import Type
from LLVMContext import LLVMContext
from StringRef import StringRef
#
Value = llvm.Class()
dump = Value.method(Void)
print_ = Value.method(Void, raw_ostream.Ref, AssemblyAnnotationWriter.Pointer)
print_.realname = 'print'
getType = Value.method(Type.Pointer)
getContext = Value.method(LLVMContext.Ref)
hasName = Value.method(Bool.To(bool))
# skip getValueName, setValueName
getName = Value.method(StringRef.To(str))
setName = Value.method(Void, StringRef.From(str))
replaceAllUsesWith = Value.method(Void, Value.Pointer)

View file

@ -40,3 +40,7 @@ fn = m.getOrInsertFunction("foo", fnty)
os = api.make_raw_ostream_for_printing()
fn.print_(os, None)
print os.str()
assert fn.hasName()
assert 'foo' == fn.getName()
fn.setName('bar')
assert 'bar' == fn.getName()