|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Copyright 2014 Philip Herron <[email protected]> |
| 3 | +# Copyright 2011 Red Hat, Inc. |
| 4 | +# |
| 5 | +# This is free software: you can redistribute it and/or modify it |
| 6 | +# under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation, either version 3 of the License, or |
| 8 | +# (at your option) any later version. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be useful, but |
| 11 | +# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | +# General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program. If not, see |
| 17 | +# <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +import gcc |
| 20 | +import pprint |
| 21 | + |
| 22 | +def gccPassHook(passname, _): |
| 23 | + if passname.name == '*free_lang_data': |
| 24 | + for i in gcc.get_translation_units (): |
| 25 | + gns = gcc.get_global_namespace () |
| 26 | + for decl in gns.declarations: |
| 27 | + if decl.is_builtin is False: |
| 28 | + pp = pprint.PrettyPrinter(indent=4) |
| 29 | + pp.pprint (str (decl.type)) |
| 30 | + pp.pprint (decl.type.fields) |
| 31 | + pp.pprint (decl.type.methods) |
| 32 | + |
| 33 | +gcc.register_callback (gcc.PLUGIN_PASS_EXECUTION, gccPassHook) |
0 commit comments