This is an archive of the discontinued LLVM Phabricator instance.

Changed ASTImporter DiagnosticsEngine from FromDiag to ToDiag for unsupported ASTNodes Import.
Needs ReviewPublic

Authored by esakella on Feb 9 2016, 6:49 AM.

Details

Summary

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".

Diff Detail

Event Timeline

esakella updated this revision to Diff 47313.Feb 9 2016, 6:49 AM
esakella retitled this revision from to Changed ASTImporter DiagnosticsEngine from FromDiag to ToDiag for unsupported ASTNodes Import..
esakella updated this object.
esakella added reviewers: rsmith, klimek, bkramer.
esakella added subscribers: cfe-commits, karies.

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.

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 ?