@@ -2771,109 +2771,6 @@ bool Compiler<Emitter>::VisitCXXInheritedCtorInitExpr(
2771
2771
return this ->emitCall (F, 0 , E);
2772
2772
}
2773
2773
2774
- template <class Emitter >
2775
- bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
2776
- assert (classifyPrim (E->getType ()) == PT_Ptr);
2777
- const Expr *Init = E->getInitializer ();
2778
- QualType ElementType = E->getAllocatedType ();
2779
- std::optional<PrimType> ElemT = classify (ElementType);
2780
- unsigned PlacementArgs = E->getNumPlacementArgs ();
2781
- bool IsNoThrow = false ;
2782
-
2783
- // FIXME: Better diagnostic. diag::note_constexpr_new_placement
2784
- if (PlacementArgs != 0 ) {
2785
- // The only new-placement list we support is of the form (std::nothrow).
2786
- //
2787
- // FIXME: There is no restriction on this, but it's not clear that any
2788
- // other form makes any sense. We get here for cases such as:
2789
- //
2790
- // new (std::align_val_t{N}) X(int)
2791
- //
2792
- // (which should presumably be valid only if N is a multiple of
2793
- // alignof(int), and in any case can't be deallocated unless N is
2794
- // alignof(X) and X has new-extended alignment).
2795
- if (PlacementArgs != 1 || !E->getPlacementArg (0 )->getType ()->isNothrowT ())
2796
- return this ->emitInvalid (E);
2797
-
2798
- if (!this ->discard (E->getPlacementArg (0 )))
2799
- return false ;
2800
- IsNoThrow = true ;
2801
- }
2802
-
2803
- const Descriptor *Desc;
2804
- if (ElemT) {
2805
- if (E->isArray ())
2806
- Desc = nullptr ; // We're not going to use it in this case.
2807
- else
2808
- Desc = P.createDescriptor (E, *ElemT, Descriptor::InlineDescMD,
2809
- /* IsConst=*/ false , /* IsTemporary=*/ false ,
2810
- /* IsMutable=*/ false );
2811
- } else {
2812
- Desc = P.createDescriptor (
2813
- E, ElementType.getTypePtr (),
2814
- E->isArray () ? std::nullopt : Descriptor::InlineDescMD,
2815
- /* IsConst=*/ false , /* IsTemporary=*/ false , /* IsMutable=*/ false , Init);
2816
- }
2817
-
2818
- if (E->isArray ()) {
2819
- std::optional<const Expr *> ArraySizeExpr = E->getArraySize ();
2820
- if (!ArraySizeExpr)
2821
- return false ;
2822
- PrimType SizeT = classifyPrim ((*ArraySizeExpr)->getType ());
2823
-
2824
- if (!this ->visit (*ArraySizeExpr))
2825
- return false ;
2826
-
2827
- if (ElemT) {
2828
- // N primitive elements.
2829
- if (!this ->emitAllocN (SizeT, *ElemT, E, IsNoThrow, E))
2830
- return false ;
2831
- } else {
2832
- // N Composite elements.
2833
- if (!this ->emitAllocCN (SizeT, Desc, IsNoThrow, E))
2834
- return false ;
2835
- }
2836
-
2837
- if (Init && !this ->visitInitializer (Init))
2838
- return false ;
2839
-
2840
- } else {
2841
- // Allocate just one element.
2842
- if (!this ->emitAlloc (Desc, E))
2843
- return false ;
2844
-
2845
- if (Init) {
2846
- if (ElemT) {
2847
- if (!this ->visit (Init))
2848
- return false ;
2849
-
2850
- if (!this ->emitInit (*ElemT, E))
2851
- return false ;
2852
- } else {
2853
- // Composite.
2854
- if (!this ->visitInitializer (Init))
2855
- return false ;
2856
- }
2857
- }
2858
- }
2859
-
2860
- if (DiscardResult)
2861
- return this ->emitPopPtr (E);
2862
-
2863
- return true ;
2864
- }
2865
-
2866
- template <class Emitter >
2867
- bool Compiler<Emitter>::VisitCXXDeleteExpr(const CXXDeleteExpr *E) {
2868
- const Expr *Arg = E->getArgument ();
2869
-
2870
- // Arg must be an lvalue.
2871
- if (!this ->visit (Arg))
2872
- return false ;
2873
-
2874
- return this ->emitFree (E->isArrayForm (), E);
2875
- }
2876
-
2877
2774
template <class Emitter >
2878
2775
bool Compiler<Emitter>::VisitExpressionTraitExpr(const ExpressionTraitExpr *E) {
2879
2776
assert (Ctx.getLangOpts ().CPlusPlus );
0 commit comments