Get AST of code in a file without using linker

  abstract-syntax-tree, c++, clang

I want to analyze a specific file located here (https://github.com/larmillo/GIZMO-CMZ/blob/master/gravity/forcetree.c)
I am trying to parse it using Clang as a frontend that can generate an AST for me.

Specifically the operation I am interested in doing is something like this:

clang -Xclang -ast-dump ./gravity/forcetree.c -I /usr/include/hdf5/serial -I /usr/include/mpi -I /home/esmerald/Documents/uci/Research/C2Bluespec/GIZMO-CMZ-master/grackle/src/clib

This produces the error:

/usr/bin/ld: cannot find /tmp/forcetree-eb92e3.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I correctly parse and print the AST of this (rather complex) file?

Source: Windows Questions C++

LEAVE A COMMENT