Before this change the errors produced by the ASTImporter when trying to import an unsupported ASTNode where produced through the DiagnosticsEngine of the FromContext. However when running clang with the -verify option, (like in this test), the VerifyDiagnosticConsumer was expecting the DiagnosticsEngine from the ToContext.
This was leading to a test like this one being considered successful despite emitting an error because the error was not being "caught".
Details
Diff Detail
Event Timeline
Doesn't this mean that _all_ of the Importer.FromDiag() calls will be ignored by VerifyDiagnosticConsumer ? Why specifically change only this two and what are we going to do with the others ?
This seems more like needing a fix higher up in the stack, not at the ASTImporter level.
Yes I think also that the right thing would be to change it in all the places, but for now we decided to make this change only in these two places which are relevant to the other things I implemented, to see first if this change would be acceptable.
I'm not sure removing all the Importer.FromDiag() calls is the right thing. You are changing
Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
to
Importer.ToDiag(SourceLocation(), diag::err_unsupported_ast_node)
and you lose the source location information.
Could you check if you can decouple VerifyDiagnosticConsumer from depending on a particular DiagnosticsEngine ?