[PATCH] D56651: [ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
Raphael Isemann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 22 10:00:00 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC351849: [ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl (authored by teemperor, committed by ).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56651/new/
https://reviews.llvm.org/D56651
Files:
lib/AST/ASTImporter.cpp
test/Import/destructor/Inputs/F.cpp
test/Import/destructor/test.cpp
Index: test/Import/destructor/Inputs/F.cpp
===================================================================
--- test/Import/destructor/Inputs/F.cpp
+++ test/Import/destructor/Inputs/F.cpp
@@ -0,0 +1,3 @@
+struct B {
+ virtual ~B() {}
+};
Index: test/Import/destructor/test.cpp
===================================================================
--- test/Import/destructor/test.cpp
+++ test/Import/destructor/test.cpp
@@ -0,0 +1,10 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s
+
+// Triggers the deserialization of B's destructor.
+B b1;
+
+// CHECK: CXXDestructorDecl
+
+// CHECK-NEXT: ~B 'void () noexcept' virtual
+// CHECK-SAME: 'void () noexcept'
+// CHECK-SAME: virtual
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -3091,12 +3091,28 @@
FromConstructor->isExplicit(),
D->isInlineSpecified(), D->isImplicit(), D->isConstexpr()))
return ToFunction;
- } else if (isa<CXXDestructorDecl>(D)) {
+ } else if (CXXDestructorDecl *FromDtor = dyn_cast<CXXDestructorDecl>(D)) {
+
+ auto Imp =
+ importSeq(const_cast<FunctionDecl *>(FromDtor->getOperatorDelete()),
+ FromDtor->getOperatorDeleteThisArg());
+
+ if (!Imp)
+ return Imp.takeError();
+
+ FunctionDecl *ToOperatorDelete;
+ Expr *ToThisArg;
+ std::tie(ToOperatorDelete, ToThisArg) = *Imp;
+
if (GetImportedOrCreateDecl<CXXDestructorDecl>(
ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
ToInnerLocStart, NameInfo, T, TInfo, D->isInlineSpecified(),
D->isImplicit()))
return ToFunction;
+
+ CXXDestructorDecl *ToDtor = cast<CXXDestructorDecl>(ToFunction);
+
+ ToDtor->setOperatorDelete(ToOperatorDelete, ToThisArg);
} else if (CXXConversionDecl *FromConversion =
dyn_cast<CXXConversionDecl>(D)) {
if (GetImportedOrCreateDecl<CXXConversionDecl>(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56651.182941.patch
Type: text/x-patch
Size: 2004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190122/1418e2b6/attachment.bin>
More information about the cfe-commits
mailing list