[PATCH] D61140: Copy Argument Passing Restrictions setting when importing a CXXRecordDecl definition

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 11:02:56 PDT 2019

shafik created this revision.
shafik added reviewers: martong, teemperor, aprantl, a_sidorin.
Herald added a subscriber: rnkovacs.

For a `CXXRecordDecl` the `RecordDeclBits` are stored in the `DeclContext`. Currently when we import the definition of a `CXXRecordDecl` via the `ASTImporter` we do not copy over this data.

We had a LLDB expression parsing bug where we would set it to not pass in registers:


but when imported this setting would be lost. So dumping the `CXXRecordDecl` before importing we would see:

  CXXRecordDecl 0x7faaba292e50 <<invalid sloc>> <invalid sloc> struct Bounds definition
  |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init

but after importing it would show the following:

  CXXRecordDecl 0x7ff286823c50 <<invalid sloc>> <invalid sloc> struct Bounds definition
  |-DefinitionData pass_in_registers standard_layout has_user_declared_ctor can_const_default_init

There will be a separate LLDB PR that will have a test that covers this and introduces a related fix for LLDB.

Note, we did not copy over any other of the `RecordDeclBits` since we don't have tests for those. We know that copying over `LoadedFieldsFromExternalStorage` would be a error and that may be the case for others as well.



Index: lib/AST/ASTImporter.cpp
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -1767,6 +1767,9 @@
       = FromData.HasDeclaredCopyAssignmentWithConstParam;
+    // Copy over the data stored in RecordDeclBits
+    ToCXX->setArgPassingRestrictions(FromCXX->getArgPassingRestrictions());
     SmallVector<CXXBaseSpecifier *, 4> Bases;
     for (const auto &Base1 : FromCXX->bases()) {
       ExpectedType TyOrErr = import(Base1.getType());

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61140.196673.patch
Type: text/x-patch
Size: 573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190425/4e9161b1/attachment-0001.bin>

More information about the cfe-commits mailing list