Skip to content

Instantly share code, notes, and snippets.

@ldzm
ldzm / libclang_show_ast.py
Created November 4, 2016 14:27 — forked from anonymous/libclang_show_ast.py
Show the AST of a translation unit with libclang and python
# inspired by http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang/
import sys
import clang.cindex
def verbose(*args, **kwargs):
'''filter predicate for show_ast: show all'''
return True
def no_system_includes(cursor, level):
'''filter predicate for show_ast: filter out verbose stuff from system include files'''