Beispiel #1
0
def gccPassHook(passname, _):
    if passname.name == '*free_lang_data':
        for i in gcc.get_translation_units ():
            gns = gcc.get_global_namespace ()
            for decl in gns.declarations:
                if decl.is_builtin is False:
                    pp = pprint.PrettyPrinter(indent=4)
                    pp.pprint (str (decl.type))
                    pp.pprint (decl.type.fields)
                    pp.pprint (decl.type.methods)
Beispiel #2
0
def gccPassHook(passname, _):
    if passname.name == '*free_lang_data':
        for i in gcc.get_translation_units():
            gns = gcc.get_global_namespace()
            for decl in gns.declarations:
                if decl.is_builtin is False:
                    pp = pprint.PrettyPrinter(indent=4)
                    pp.pprint(str(decl.type))
                    pp.pprint(decl.type.fields)
                    pp.pprint(decl.type.methods)
def get_global_vardecl_by_name(name):
    # Look up a variable in global scope by name, returning a gcc.VarDecl,
    # or None if not found
    for u in gcc.get_translation_units():
        if u.language == 'GNU C++':
            gns = gcc.get_global_namespace()
            return gns.lookup(name)
        for v in u.block.vars:
            if isinstance(v, gcc.VarDecl):
                if v.name == name:
                    return v
def get_global_vardecl_by_name(name):
    # Look up a variable in global scope by name, returning a gcc.VarDecl,
    # or None if not found
    for u in gcc.get_translation_units():
        if u.language == 'GNU C++':
            gns = gcc.get_global_namespace()
            return gns.lookup(name)
        for v in u.block.vars:
            if isinstance(v, gcc.VarDecl):
                if v.name == name:
                    return v
def get_global_typedef(name):
    # Look up a typedef in global scope by name, returning a gcc.TypeDecl,
    # or None if not found
    for u in gcc.get_translation_units():
        if u.language.startswith('GNU C++'):
            gns = gcc.get_global_namespace()
            return gns.lookup(name)
        if u.block:
            for v in u.block.vars:
                if isinstance(v, gcc.TypeDecl):
                    if v.name == name:
                        return v
def get_global_typedef(name):
    # Look up a typedef in global scope by name, returning a gcc.TypeDecl,
    # or None if not found
    for u in gcc.get_translation_units():
        if u.language == 'GNU C++':
            gns = gcc.get_global_namespace()
            return gns.lookup(name)
        if u.block:
            for v in u.block.vars:
                if isinstance(v, gcc.TypeDecl):
                    if v.name == name:
                        return v
Beispiel #7
0
def gccPassHook ():
    global TranslationUnit
    for i in gcc.get_variables ():
        TranslationUnit.append (i.decl)
    for i in gcc.get_translation_units ():
        if i.language == 'GNU C++':
            TranslationUnit = []
            gns = gcc.get_global_namespace ()
            for decl in gns.namespaces:
                if decl.is_builtin is False:
                    TranslationUnit.append (decl)
            for decl in gns.declarations:
                if decl.is_builtin is False:
                    TranslationUnit.append (decl)
        else:
            for y in i.block.vars:
                if type (y) is not gcc.VarDecl:
                    TranslationUnit.append (y)
    pxdutil.pxdcompile (TranslationUnit)
Beispiel #8
0
def finish_unit_cb(*args, **kwargs):
    # depth of -1 to ignore the global namespace itself (because its a builtin).
    dump_namespaces(gcc.get_global_namespace(), -1)
Beispiel #9
0
def finish_unit_cb(*args, **kwargs):
  # depth of -1 to ignore the global namespace itself (because its a builtin).
  dump_namespaces(gcc.get_global_namespace(), -1)