def add_metadata_type(ir):
 buf = []
 for line in ir.splitlines():
  if re_metadata_def.match(line):
   if (None is re_metadata_correct_usage.search(line)):
    line = line.replace('!{', 'metadata !{')
    line = line.replace('!"', 'metadata !"')
    def sub_metadata(m):
     return 'metadata {0}'.format(m.group(0))
    line = re_metadata_ref.sub(sub_metadata, line)
    line = line.lstrip('metadata ')
  buf.append(line)
 return '\n'.join(buf)

def add_metadata_type ( ir ) : buf = [ ] for line in ir . splitlines ( ) : if re_metadata_def . match ( line ) : if ( None is re_metadata_correct_usage . search ( line ) ) : line = line . replace ( '!{' , 'metadata !{' ) line = line . replace ( '!"' , 'metadata !"' ) def sub_metadata ( m ) : return 'metadata {0}' . format ( m . group ( 0 ) ) line = re_metadata_ref . sub ( sub_metadata , line ) line = line . lstrip ( 'metadata ' ) buf . append ( line ) return '\n' . join ( buf )
rewrite metadata since llvm3 .