Support MetaDataString, and correctly represent MetaData Values in _make_value

This commit is contained in:
Wladimir J. van der Laan 2012-09-12 21:11:33 +02:00
commit e2d8079b93
5 changed files with 31 additions and 3 deletions

View file

@ -1478,6 +1478,17 @@ class MetaData(Value):
def _get_operand(self, i):
return _make_value(_core.LLVMMetaDataGetOperand(self.ptr, i))
class MetaDataString(Value):
@staticmethod
def get(module, s):
ptr = _core.LLVMMetaDataStringGet(module.ptr, s)
return MetaDataString(ptr)
@property
def string(self):
'''Same as MDString::getString'''
return self.name
#===----------------------------------------------------------------------===
# Instruction
#===----------------------------------------------------------------------===
@ -1648,6 +1659,8 @@ __class_for_valueid = {
VALUE_CONSTANT_STRUCT : ConstantStruct,
VALUE_CONSTANT_VECTOR : ConstantVector,
VALUE_CONSTANT_POINTER_NULL : ConstantPointerNull,
VALUE_MD_NODE : MetaData,
VALUE_MD_STRING : MetaDataString,
VALUE_INSTRUCTION + OPCODE_PHI : PHINode,
VALUE_INSTRUCTION + OPCODE_CALL : CallOrInvokeInstruction,
VALUE_INSTRUCTION + OPCODE_INVOKE : CallOrInvokeInstruction,