diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-12 02:53:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-12 02:53:20 +0000 |
commit | 410306bf6ed906af77978caa199e5d96376bae66 (patch) | |
tree | 811f32246733190c960c7785c3dd02587d43be1d /clang/lib/Sema/TreeTransform.h | |
parent | 8c9cc8c86be80abd4224341314725d03551460d6 (diff) | |
download | bcm5719-llvm-410306bf6ed906af77978caa199e5d96376bae66.tar.gz bcm5719-llvm-410306bf6ed906af77978caa199e5d96376bae66.zip |
Add two new AST nodes to represent initialization of an array in terms of
initialization of each array element:
* ArrayInitLoopExpr is a prvalue of array type with two subexpressions:
a common expression (an OpaqueValueExpr) that represents the up-front
computation of the source of the initialization, and a subexpression
representing a per-element initializer
* ArrayInitIndexExpr is a prvalue of type size_t representing the current
position in the loop
This will be used to replace the creation of explicit index variables in lambda
capture of arrays and copy/move construction of classes with array elements,
and also C++17 structured bindings of arrays by value (which inexplicably allow
copying an array by value, unlike all of C++'s other array declarations).
No uses of these nodes are introduced by this change, however.
llvm-svn: 289413
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 1a07e719f12..af60a56564c 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3221,6 +3221,9 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init, if (ExprWithCleanups *ExprTemp = dyn_cast<ExprWithCleanups>(Init)) Init = ExprTemp->getSubExpr(); + if (auto *AIL = dyn_cast<ArrayInitLoopExpr>(Init)) + Init = AIL->getCommonExpr(); + if (MaterializeTemporaryExpr *MTE = dyn_cast<MaterializeTemporaryExpr>(Init)) Init = MTE->GetTemporaryExpr(); @@ -9047,6 +9050,20 @@ TreeTransform<Derived>::TransformNoInitExpr( template<typename Derived> ExprResult +TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *E) { + llvm_unreachable("Unexpected ArrayInitLoopExpr outside of initializer"); + return ExprError(); +} + +template<typename Derived> +ExprResult +TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *E) { + llvm_unreachable("Unexpected ArrayInitIndexExpr outside of initializer"); + return ExprError(); +} + +template<typename Derived> +ExprResult TreeTransform<Derived>::TransformImplicitValueInitExpr( ImplicitValueInitExpr *E) { TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName()); |