diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-20 01:47:58 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-20 01:47:58 +0000 |
| commit | 3797638dfd454c47eb4b1fea5a44c8c96d4ce442 (patch) | |
| tree | 4273481e5055fe8b76c9a24b3b1748e76233427a /lib/CodeGen/CGExprAgg.cpp | |
| parent | 1e4ad8ec340cc0b252fe7fad89906ec1452a7ff7 (diff) | |
| download | clang-3797638dfd454c47eb4b1fea5a44c8c96d4ce442.tar.gz | |
[CodeGen] Ignore OpaqueValueExprs that are unique references to their
source expressions when iterating over a PseudoObjectExpr's semantic
subexpression list.
Previously the loop in emitPseudoObjectExpr would emit the IR for each
OpaqueValueExpr that was in a PseudoObjectExpr's semantic-form
expression list and use the result when the OpaqueValueExpr later
appeared in other expressions. This caused an assertion failure when
AggExprEmitter tried to copy the result of an OpaqueValueExpr and the
copied type didn't have trivial copy/move constructors or assignment
operators.
This patch adds flag IsUnique to OpaqueValueExpr which indicates it is a
unique reference to its source expression (it is not used in multiple
places). The loop in emitPseudoObjectExpr ignores OpaqueValueExprs that
are unique and CodeGen visitors simply traverse the source expressions
of such OpaqueValueExprs.
rdar://problem/34363596
Differential Revision: https://reviews.llvm.org/D39562
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 371c14cde0..959086891c 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -630,7 +630,11 @@ void AggExprEmitter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E){ } void AggExprEmitter::VisitOpaqueValueExpr(OpaqueValueExpr *e) { - EmitFinalDestCopy(e->getType(), CGF.getOpaqueLValueMapping(e)); + // If this is a unique OVE, just visit its source expression. + if (e->isUnique()) + Visit(e->getSourceExpr()); + else + EmitFinalDestCopy(e->getType(), CGF.getOrCreateOpaqueLValueMapping(e)); } void |
