aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-07-26 19:22:48 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-07-30 12:51:36 +0200
commitc18db639a31b9d651b3b997fee331106b25789ef (patch)
tree84ec1d17678b786615df60842eaeb79cfe14323a /gcc/d
parent370f66b6af3e70ac31593d60a00d328a3368834a (diff)
downloadgcc-c18db639a31b9d651b3b997fee331106b25789ef.zip
gcc-c18db639a31b9d651b3b997fee331106b25789ef.tar.gz
gcc-c18db639a31b9d651b3b997fee331106b25789ef.tar.bz2
d: Clarify comment for generating static array assignment with literal.
The code block is done as an optimization to elide a call to the runtime library helpers _d_arrayctor or _d_arrayassign. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssignExp *)): Clarify comment for generating static array assignment with literal.
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/expr.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index 85269c6..76c1e61 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -1163,9 +1163,9 @@ public:
bool destructor = needs_dtor (etype);
bool lvalue = lvalue_p (e->e2);
- /* Even if the elements in rhs are all rvalues and don't have
- to call postblits, this assignment should call dtors on old
- assigned elements. */
+ /* Optimize static array assignment with array literal. Even if the
+ elements in rhs are all rvalues and don't have to call postblits,
+ this assignment should call dtors on old assigned elements. */
if ((!postblit && !destructor)
|| (e->op == TOKconstruct && e->e2->op == TOKarrayliteral)
|| (e->op == TOKconstruct && !lvalue && postblit)