This is an archive of the discontinued LLVM Phabricator instance.

[clang][AST] Add support for BindingDecl to ASTImporter.
ClosedPublic

Authored by balazske on May 14 2021, 6:02 AM.

Diff Detail

Event Timeline

balazske created this revision.May 14 2021, 6:02 AM
balazske requested review of this revision.May 14 2021, 6:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 6:02 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
shafik added inline comments.May 17 2021, 10:26 AM
clang/unittests/AST/ASTImporterTest.cpp
887

Can we add a larger variety of tests? Given how simple the BindingDecl case seems to be I don't expect any surprises but it would be good to verify that cases like mixed types, references and bit-fields work as expected.

balazske updated this revision to Diff 346169.May 18 2021, 7:06 AM

Improved the test.

This change in itself is not enough to support BindingDecl. The tests pass but the resulting AST is not correct because DecompositionDecl is not imported yet. Still no visible problem happens, the DecompositionDecl is just visited and imported as a VarDecl. The import of DecompositionDecl can be added later (but I am not sure if without it the new import of BindingDecl will not cause hidden problems).

clang/unittests/AST/ASTImporterTest.cpp
887

Improved the test variety a bit. (std::tuple is more difficult to handle because need for namespace std.)

I like it, though I've found a nit.

clang/lib/AST/ASTImporter.cpp
2318

Should we use rather addDeclToContexts ?

balazske updated this revision to Diff 352372.Jun 16 2021, 1:30 AM

Using addDeclToContexts.

martong accepted this revision.Jul 1 2021, 9:37 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Jul 1 2021, 9:37 AM
balazske updated this revision to Diff 356110.Jul 1 2021, 11:52 PM
balazske marked an inline comment as done.

Not using auto declarations.

martong accepted this revision.Jul 2 2021, 12:32 AM

Not using auto declarations.

Still looks good, thanks!

This revision was landed with ongoing or failed builds.Jul 2 2021, 1:03 AM
This revision was automatically updated to reflect the committed changes.