[cfe-dev] Get the diagnostics from ASTUnit::LoadFromAstFile

Hendrik vP variadic.template at googlemail.com
Thu Mar 22 15:23:25 PDT 2012


I fail at the try to load an AST-file with theĀ ASTUnit::LoadFromASTFile-method.
I won't post how i generate the ast-file and my code for loading it,
as I'm aiming
for something different: I want the error-messages from the diagnostic engine
to see what I'm doing wrong.

Thus, i created an instance of the TextDiagnosticBuffer-class and set
it as client
to the DiagnosticsEngine. As it didn't work, i digged into the
LoadFromASTFile-method.
In line 666 (this can't be a good sign), the ConfigureDiags-method
gets called an
in that, the client will be set to an instance of the
StoredDiagnosticConsumer-class, which
neither is part of the public API nor gives me the possibility to get
the error-messages.

Curiously, ASTUnit adds another error-diagnostic in line 772 before
returning NULL.

So, is there an 'official' way to get the diagnostics or maybe I have
misunderstood
the usage of the LoadFromASTFile? Why is the client of the DiagnosticsEngine
set to StoredDiagnosticConsumer - would it be possible to not
overwrite the current
one, maybe by setting a flag?

Regards,
Hendrik




More information about the cfe-dev mailing list