r359338 - [ASTImporter] Copy Argument Passing Restrictions setting when importing a CXXRecordDecl definition
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 11:51:29 PDT 2019
Author: shafik
Date: Fri Apr 26 11:51:28 2019
New Revision: 359338
URL: http://llvm.org/viewvc/llvm-project?rev=359338&view=rev
Log:
[ASTImporter] Copy Argument Passing Restrictions setting when importing a CXXRecordDecl definition
Summary:
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.
This change will add support for copying the ArgPassingRestrictions from RecordDeclBits to fix an LLDB expression parsing bug where we would set it to not pass in registers.
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.
The companion LLDB review: https://reviews.llvm.org/D61146
Differential Review: https://reviews.llvm.org/D61140
Added:
cfe/trunk/test/Import/cxx-record-flags/
cfe/trunk/test/Import/cxx-record-flags/Inputs/
cfe/trunk/test/Import/cxx-record-flags/Inputs/F.cpp
cfe/trunk/test/Import/cxx-record-flags/test.cpp
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=359338&r1=359337&r2=359338&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Apr 26 11:51:28 2019
@@ -1767,6 +1767,9 @@ Error ASTNodeImporter::ImportDefinition(
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());
Added: cfe/trunk/test/Import/cxx-record-flags/Inputs/F.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/cxx-record-flags/Inputs/F.cpp?rev=359338&view=auto
==============================================================================
--- cfe/trunk/test/Import/cxx-record-flags/Inputs/F.cpp (added)
+++ cfe/trunk/test/Import/cxx-record-flags/Inputs/F.cpp Fri Apr 26 11:51:28 2019
@@ -0,0 +1,9 @@
+class FTrivial {
+ int i;
+};
+
+struct FNonTrivial {
+ virtual ~FNonTrivial() = default;
+ int i;
+};
+
Added: cfe/trunk/test/Import/cxx-record-flags/test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/cxx-record-flags/test.cpp?rev=359338&view=auto
==============================================================================
--- cfe/trunk/test/Import/cxx-record-flags/test.cpp (added)
+++ cfe/trunk/test/Import/cxx-record-flags/test.cpp Fri Apr 26 11:51:28 2019
@@ -0,0 +1,14 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: FTrivial
+// CHECK: DefinitionData
+// CHECK-SAME: pass_in_registers
+
+// CHECK: FNonTrivial
+// CHECK-NOT: pass_in_registers
+// CHECK: DefaultConstructor
+
+void expr() {
+ FTrivial f1;
+ FNonTrivial f2;
+}
More information about the cfe-commits
mailing list