This is an archive of the discontinued LLVM Phabricator instance.

[ASTImporter] Re-odering by lexical order for all imported decls within record
AbandonedPublic

Authored by danix800 on Jul 24 2023, 3:11 AM.

Details

Summary

Revision https://reviews.llvm.org/D154764 is still not complete. An extra reordering is
needed for lexical order of all imported decls within a record. The final algorithm could
be summarized as the following:

  1. Import all fields that'll be part of the layout;
  2. Sort these fields to ensure correct layout;
  3. Import everything else;
  4. Final re-ordering by lexical order.

Fixes https://github.com/llvm/llvm-project/issues/64165

Diff Detail

Event Timeline

danix800 created this revision.Jul 24 2023, 3:11 AM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: martong. · View Herald Transcript
danix800 requested review of this revision.Jul 24 2023, 3:11 AM
danix800 planned changes to this revision.Jul 24 2023, 3:15 AM
danix800 updated this revision to Diff 543535.Jul 24 2023, 7:21 AM
danix800 retitled this revision from [ASTImporter] Add extra sorting round for keeping lexical order of all imported decls within record to [ASTImporter] Re-odering by lexical order for all imported decls within record.
danix800 edited the summary of this revision. (Show Details)
danix800 added a reviewer: balazske.
danix800 edited the summary of this revision. (Show Details)Jul 27 2023, 11:21 AM
shafik added inline comments.Jul 27 2023, 7:15 PM
clang/lib/AST/ASTImporter.cpp
1950

If ToDC does not contain the decl is that a problem, what case do we expect this to happen? Do we test that case?

danix800 added a comment.EditedJul 27 2023, 8:56 PM

After thought a little bit more I'm doubting whether this lexical ordering is of any practical usage or any meanfullness at all,
especially when imported into existing (non-empty) context, reordering by From context can not be correct after merging
occured.

I need more comment on this before I close it.

danix800 abandoned this revision.Aug 1 2023, 8:24 PM