def get_tu(source, lang='c', all_warnings=False, flags=[]):
 args = list(flags)
 name = 't.c'
 if (lang == 'cpp'):
  name = 't.cpp'
  args.append('-std=c++11')
 elif (lang == 'objc'):
  name = 't.m'
 elif (lang != 'c'):
  raise Exception(('Unknown language: %s' % lang))
 if all_warnings:
  args += ['-Wall', '-Wextra']
 return TranslationUnit.from_source(name, args, unsaved_files=[(name, source)])

def get_tu ( source , lang = 'c' , all_warnings = False , flags = [ ] ) : args = list ( flags ) name = 't.c' if ( lang == 'cpp' ) : name = 't.cpp' args . append ( '-std=c++11' ) elif ( lang == 'objc' ) : name = 't.m' elif ( lang != 'c' ) : raise Exception ( ( 'Unknown language: %s' % lang ) ) if all_warnings : args += [ '-Wall' , '-Wextra' ] return TranslationUnit . from_source ( name , args , unsaved_files = [ ( name , source ) ] )
obtain a translation unit from source and language .