Check If AST File is Valid

I'm using AST files to make call graphs on a large project, and I'm having
some trouble. I think it's because some of the files that I think are AST
are, in fact, not.

Does Clang have any easy way to tell if a file is a valid AST file?


I'm not sure if this is what you're looking for, but I see that ASTWriter::WriteAST (in lib/Serialization/ASTWriter.cpp) outputs a few characters as a file signature(which look like a magic number to me), which you can see at the top of the function definition.

Hope that helps,