mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
Provide a real fix for PR6199, reverting the old workaround. Here, we
realize that CXXConstructExpr is always implicit, so we should just return its argument (if there is only one) rather than directly invoking the constructor. llvm-svn: 95192
This commit is contained in:
@@ -309,9 +309,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
|
||||
if (getContext().getLangOptions().ElideConstructors && E->isElidable()) {
|
||||
const Expr *Arg = E->getArg(0);
|
||||
|
||||
// FIXME: This 'while' statement should really be an 'if' statement, it's
|
||||
// added as a workaround for PR6199.
|
||||
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
|
||||
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
|
||||
assert((ICE->getCastKind() == CastExpr::CK_NoOp ||
|
||||
ICE->getCastKind() == CastExpr::CK_ConstructorConversion ||
|
||||
ICE->getCastKind() == CastExpr::CK_UserDefinedConversion) &&
|
||||
|
||||
@@ -4808,6 +4808,12 @@ TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
|
||||
template<typename Derived>
|
||||
Sema::OwningExprResult
|
||||
TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
|
||||
// CXXConstructExprs are always implicit, so when we have a
|
||||
// 1-argument construction we just transform that argument.
|
||||
if (E->getNumArgs() == 1 ||
|
||||
(E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1))))
|
||||
return getDerived().TransformExpr(E->getArg(0));
|
||||
|
||||
TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
|
||||
|
||||
QualType T = getDerived().TransformType(E->getType());
|
||||
|
||||
Reference in New Issue
Block a user