@@ -3356,7 +3356,8 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
33563356 if (E->isArray ())
33573357 Desc = nullptr ; // We're not going to use it in this case.
33583358 else
3359- Desc = P.createDescriptor (E, *ElemT, Descriptor::InlineDescMD,
3359+ Desc = P.createDescriptor (E, *ElemT, /* SourceTy=*/ nullptr ,
3360+ Descriptor::InlineDescMD,
33603361 /* IsConst=*/ false , /* IsTemporary=*/ false ,
33613362 /* IsMutable=*/ false );
33623363 } else {
@@ -3517,7 +3518,7 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
35173518 // ++Iter;
35183519 if (!this ->emitGetPtrLocal (Iter, E))
35193520 return false ;
3520- if (!this ->emitIncPop (SizeT, E))
3521+ if (!this ->emitIncPop (SizeT, false , E))
35213522 return false ;
35223523
35233524 if (!this ->jump (StartLabel))
@@ -4260,8 +4261,8 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(
42604261 // FIXME: There are cases where Src.is<Expr*>() is wrong, e.g.
42614262 // (int){12} in C. Consider using Expr::isTemporaryObject() instead
42624263 // or isa<MaterializeTemporaryExpr>().
4263- Descriptor *D = P.createDescriptor (Src, Ty, Descriptor::InlineDescMD, IsConst ,
4264- isa<const Expr *>(Src));
4264+ Descriptor *D = P.createDescriptor (Src, Ty, nullptr , Descriptor::InlineDescMD,
4265+ IsConst, isa<const Expr *>(Src));
42654266 Scope::Local Local = this ->createLocal (D);
42664267 if (auto *VD = dyn_cast_if_present<ValueDecl>(Src.dyn_cast <const Decl *>()))
42674268 Locals.insert ({VD, Local});
@@ -5956,7 +5957,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
59565957 : this ->emitIncf (getFPOptions (E), E);
59575958 }
59585959
5959- return DiscardResult ? this ->emitIncPop (*T, E) : this ->emitInc (*T, E);
5960+ return DiscardResult ? this ->emitIncPop (*T, E->canOverflow (), E)
5961+ : this ->emitInc (*T, E->canOverflow (), E);
59605962 }
59615963 case UO_PostDec: { // x--
59625964 if (!Ctx.getLangOpts ().CPlusPlus14 )
@@ -5979,7 +5981,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
59795981 : this ->emitDecf (getFPOptions (E), E);
59805982 }
59815983
5982- return DiscardResult ? this ->emitDecPop (*T, E) : this ->emitDec (*T, E);
5984+ return DiscardResult ? this ->emitDecPop (*T, E->canOverflow (), E)
5985+ : this ->emitDec (*T, E->canOverflow (), E);
59835986 }
59845987 case UO_PreInc: { // ++x
59855988 if (!Ctx.getLangOpts ().CPlusPlus14 )
@@ -6004,7 +6007,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60046007 if (DiscardResult) {
60056008 if (T == PT_Float)
60066009 return this ->emitIncfPop (getFPOptions (E), E);
6007- return this ->emitIncPop (*T, E);
6010+ return this ->emitIncPop (*T, E-> canOverflow (), E );
60086011 }
60096012
60106013 if (T == PT_Float) {
@@ -6019,13 +6022,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60196022 return false ;
60206023 } else {
60216024 assert (isIntegralType (*T));
6022- if (!this ->emitLoad (*T, E))
6023- return false ;
6024- if (!this ->emitConst (1 , E))
6025- return false ;
6026- if (!this ->emitAdd (*T, E))
6027- return false ;
6028- if (!this ->emitStore (*T, E))
6025+ if (!this ->emitPreInc (*T, E->canOverflow (), E))
60296026 return false ;
60306027 }
60316028 return E->isGLValue () || this ->emitLoadPop (*T, E);
@@ -6053,7 +6050,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60536050 if (DiscardResult) {
60546051 if (T == PT_Float)
60556052 return this ->emitDecfPop (getFPOptions (E), E);
6056- return this ->emitDecPop (*T, E);
6053+ return this ->emitDecPop (*T, E-> canOverflow (), E );
60576054 }
60586055
60596056 if (T == PT_Float) {
@@ -6068,13 +6065,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60686065 return false ;
60696066 } else {
60706067 assert (isIntegralType (*T));
6071- if (!this ->emitLoad (*T, E))
6072- return false ;
6073- if (!this ->emitConst (1 , E))
6074- return false ;
6075- if (!this ->emitSub (*T, E))
6076- return false ;
6077- if (!this ->emitStore (*T, E))
6068+ if (!this ->emitPreDec (*T, E->canOverflow (), E))
60786069 return false ;
60796070 }
60806071 return E->isGLValue () || this ->emitLoadPop (*T, E);
0 commit comments