[cfe-dev] Clang Python Bindings - Reading AST file dumped by clang

Daniel Kats via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 7 13:54:01 PST 2015


Hi,

I am have generated a clang AST by running these commands on Windows on the
Visual Studio command-line:

clang-cl <header-name> -Xclang -ast-dump -fsyntax-only
-fno-color-diagnostics -w

 And saved it in a file f.ast

I now want to take that file as input into a Python script, so I wrote this
code:

Config.set_library_fie(libclang_path)
index = Index.create()
logging.debug( "Reading AST file...")
tu = index.read("f.ast")
logging.debug( "done parsing AST" )
# other stuff below

When I run this, I see command-line output:
"Reading AST file..."

And I get a popup indicating a C/C++ error in libclang.dll:
"Expression: ((End-Start) & 3) == 0 && "Bitcode stream not a multiple of 4
bytes""

Do you know why this happens, and how to fix?

- Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151207/221ad1f9/attachment.html>


More information about the cfe-dev mailing list