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: setArgPassingRestrictions(clang::RecordDecl::APK_CannotPassInRegs); 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. https://reviews.llvm.org/D61140 Files: lib/AST/ASTImporter.cpp Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -1767,6 +1767,9 @@ ToData.HasDeclaredCopyAssignmentWithConstParam = 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());
Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -1767,6 +1767,9 @@ ToData.HasDeclaredCopyAssignmentWithConstParam = 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());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits