[PATCH] D49293: [ASTImporter] Add support for import of CXXInheritedCtorInitExpr.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 25 03:21:23 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC337898: [ASTImporter] Add support for import of CXXInheritedCtorInitExpr. (authored by balazske, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49293?vs=155838&id=157212#toc
Repository:
rC Clang
https://reviews.llvm.org/D49293
Files:
lib/AST/ASTImporter.cpp
test/Import/inherited-ctor-init-expr/Inputs/A.cpp
test/Import/inherited-ctor-init-expr/test.cpp
Index: test/Import/inherited-ctor-init-expr/Inputs/A.cpp
===================================================================
--- test/Import/inherited-ctor-init-expr/Inputs/A.cpp
+++ test/Import/inherited-ctor-init-expr/Inputs/A.cpp
@@ -0,0 +1,11 @@
+class A {
+public:
+ A(int a) : a(a) {}
+ int a;
+};
+class B : public A {
+ using A::A;
+};
+class C : public B {
+ C() : B(1) {}
+};
Index: test/Import/inherited-ctor-init-expr/test.cpp
===================================================================
--- test/Import/inherited-ctor-init-expr/test.cpp
+++ test/Import/inherited-ctor-init-expr/test.cpp
@@ -0,0 +1,6 @@
+// RUN: clang-import-test -dump-ast -expression=%s -import=%S/Inputs/A.cpp | FileCheck %s
+// CHECK: | | | `-CXXInheritedCtorInitExpr
+
+void foo() {
+ C c;
+}
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -460,6 +460,7 @@
Expr *VisitLambdaExpr(LambdaExpr *LE);
Expr *VisitInitListExpr(InitListExpr *E);
Expr *VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E);
+ Expr *VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E);
Expr *VisitArrayInitLoopExpr(ArrayInitLoopExpr *E);
Expr *VisitArrayInitIndexExpr(ArrayInitIndexExpr *E);
Expr *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E);
@@ -6772,6 +6773,22 @@
return new (Importer.getToContext()) CXXStdInitializerListExpr(T, SE);
}
+Expr *ASTNodeImporter::VisitCXXInheritedCtorInitExpr(
+ CXXInheritedCtorInitExpr *E) {
+ QualType T = Importer.Import(E->getType());
+ if (T.isNull())
+ return nullptr;
+
+ auto *Ctor = cast_or_null<CXXConstructorDecl>(Importer.Import(
+ E->getConstructor()));
+ if (!Ctor)
+ return nullptr;
+
+ return new (Importer.getToContext()) CXXInheritedCtorInitExpr(
+ Importer.Import(E->getLocation()), T, Ctor,
+ E->constructsVBase(), E->inheritedFromVBase());
+}
+
Expr *ASTNodeImporter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
QualType ToType = Importer.Import(E->getType());
if (ToType.isNull())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49293.157212.patch
Type: text/x-patch
Size: 2113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180725/fc7c2dcc/attachment-0001.bin>
More information about the cfe-commits
mailing list