[PATCH] D48631: [ASTImporter] Added import of CXXStdInitializerListExpr
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 29 05:22:20 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL335968: [ASTImporter] Added import of CXXStdInitializerListExpr (authored by martong, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D48631
Files:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp
Index: cfe/trunk/lib/AST/ASTImporter.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp
+++ cfe/trunk/lib/AST/ASTImporter.cpp
@@ -384,6 +384,7 @@
Expr *VisitCallExpr(CallExpr *E);
Expr *VisitLambdaExpr(LambdaExpr *LE);
Expr *VisitInitListExpr(InitListExpr *E);
+ Expr *VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E);
Expr *VisitArrayInitLoopExpr(ArrayInitLoopExpr *E);
Expr *VisitArrayInitIndexExpr(ArrayInitIndexExpr *E);
Expr *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E);
@@ -6622,6 +6623,19 @@
return To;
}
+Expr *ASTNodeImporter::VisitCXXStdInitializerListExpr(
+ CXXStdInitializerListExpr *E) {
+ QualType T = Importer.Import(E->getType());
+ if (T.isNull())
+ return nullptr;
+
+ Expr *SE = Importer.Import(E->getSubExpr());
+ if (!SE)
+ return nullptr;
+
+ return new (Importer.getToContext()) CXXStdInitializerListExpr(T, SE);
+}
+
Expr *ASTNodeImporter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {
QualType ToType = Importer.Import(E->getType());
if (ToType.isNull())
Index: cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
===================================================================
--- cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
+++ cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
@@ -0,0 +1,9 @@
+namespace std {
+template <typename T>
+struct initializer_list {
+ const T *begin, *end;
+ initializer_list();
+};
+} // namespace std
+
+std::initializer_list<int> IL = {1, 2, 3, 4};
Index: cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp
===================================================================
--- cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp
+++ cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/il.cpp
+// RUN: %clang_cc1 -ast-merge %t.1.ast -fsyntax-only %s 2>&1 | FileCheck --allow-empty %s
+// CHECK-NOT: unsupported AST node
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48631.153480.patch
Type: text/x-patch
Size: 2027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180629/820ec805/attachment.bin>
More information about the cfe-commits
mailing list