ParseAST and Diagnostics

Hi all,

I have two questions about Diagnostics and ParseAST:

1. How can I prevent printing diagnostic messages to terminal, but get the error information internally?
If I use getSuppressAllDiagnostics or setIgnoreAllWarnings, then hasErrorOccurred returns always false. I want to get some information about parsing-error, warning, etc internally.

2. ParseAST cannot find standard headers.
For example, the input file is as follows: