r335968 - [ASTImporter] Added import of CXXStdInitializerListExpr
Gabor Marton via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 29 05:17:34 PDT 2018
Author: martong
Date: Fri Jun 29 05:17:34 2018
New Revision: 335968
URL: http://llvm.org/viewvc/llvm-project?rev=335968&view=rev
Log:
[ASTImporter] Added import of CXXStdInitializerListExpr
Reviewers: a.sidorin
Reviewed By: a.sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D48631
Patch by Balazs Keri!
Added:
cfe/trunk/test/ASTMerge/std-initializer-list/
cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/
cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
cfe/trunk/test/ASTMerge/std-initializer-list/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=335968&r1=335967&r2=335968&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Jun 29 05:17:34 2018
@@ -384,6 +384,7 @@ namespace clang {
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 @@ Expr *ASTNodeImporter::VisitInitListExpr
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())
Added: cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp?rev=335968&view=auto
==============================================================================
--- cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp (added)
+++ cfe/trunk/test/ASTMerge/std-initializer-list/Inputs/il.cpp Fri Jun 29 05:17:34 2018
@@ -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};
Added: cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp?rev=335968&view=auto
==============================================================================
--- cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp (added)
+++ cfe/trunk/test/ASTMerge/std-initializer-list/test.cpp Fri Jun 29 05:17:34 2018
@@ -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
More information about the cfe-commits
mailing list