This is an archive of the discontinued LLVM Phabricator instance.

[clang][ASTImporter] Improve import of functions with auto return type.
ClosedPublic

Authored by balazske on Jul 28 2022, 5:44 AM.

Details

Summary

ASTImporter used to crash in some cases when a function is imported with
auto return type and the return type has references into the function.
The handling of such cases is improved and crash should not occur any more
but it is not fully verified, there are very many different types of
cases to care for.

Diff Detail

Event Timeline

balazske created this revision.Jul 28 2022, 5:44 AM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
balazske requested review of this revision.Jul 28 2022, 5:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2022, 5:44 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

It is still not perfect, analysis of qtbase is not better than before and some of the unreachable assertions were encountered.

It is still not perfect, analysis of qtbase is not better than before and some of the unreachable assertions were encountered.

Does it mean you plan some updates on this patch?

Yes, I plan to add improvements but the current code remains mostly. I found other type of error (in project qtbase) that are not directly related, too (infinite import loop of deduction guide without auto return value, one of the function arguments is involved), these will remain for future work.

balazske updated this revision to Diff 449668.Aug 3 2022, 8:00 AM
  • Added a new test
  • Call the visitor only if the function has auto return type

Thank you, nice and assiduous work!

The changes look good to me, but I think we should have some more tests where variable and function template specializations are used as return types.

balazske updated this revision to Diff 450716.Aug 8 2022, 12:41 AM

Removed one unreachable, added new tests, improvement of TagDecl check, re-arranged source code.

martong accepted this revision.Aug 8 2022, 6:54 AM

Thank you for the update! LGTM!

This revision is now accepted and ready to land.Aug 8 2022, 6:54 AM