Doing this will cause diagnostics to be printed as expected. I think
that it would be appropriate to add this to unit tests that currently
use clang::ParseAST as it might be useful to other people who refers
to those for code examples.
If that sounds appropriate to you all, then I can go ahead and submit
a patch. Otherwise I'd appreciate some input on where it might be
appropriate to add documentation on this as it seems fairly confusing.
I've pasted a diff of a sketch of the changes I'm proposing below.
< clang::DiagnosticConsumer& DC = CI.getDiagnosticClient();
< DC.clear(); // Clear out any pre existing errors.
< DC.BeginSourceFile( CI.getLangOpts(), &CI.getPreprocessor() );
< if ( DC.getNumErrors() ) // An error occured parsing the file.
< return nullptr;
cfe-dev mailing list
[hidden email] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev