================ @@ -6400,6 +6403,67 @@ bool Compiler<Emitter>::emitDestruction(const Descriptor *Desc, return this->emitRecordDestruction(Desc->ElemRecord, Loc); } +// This function is constexpr if and only if To, From, and the types of +// all subobjects of To and From are types T such that... +// (3.1) - is_union_v<T> is false; +// (3.2) - is_pointer_v<T> is false; +// (3.3) - is_member_pointer_v<T> is false; +// (3.4) - is_volatile_v<T> is false; and +// (3.5) - T has no non-static data members of reference type +template <class Emitter> +bool Compiler<Emitter>::emitBuiltinBitCast(const CastExpr *E) { + const Expr *SubExpr = E->getSubExpr(); + QualType FromType = SubExpr->getType(); + QualType ToType = E->getType(); + std::optional<PrimType> ToT = classify(ToType); + + assert(!DiscardResult && "Implement"); + + if (ToType->isNullPtrType()) { + if (!this->discard(SubExpr)) + return false; + + return this->emitNullPtr(nullptr, E); + } + + if (FromType->isNullPtrType() && ToT) { + if (!this->discard(SubExpr)) + return false; + + return visitZeroInitializer(*ToT, ToType, E); + } + assert(!ToType->isReferenceType()); + + // Get a pointer to the value-to-cast on the stack. + if (!this->visit(SubExpr)) + return false; + + if (!ToT || ToT == PT_Ptr) { + // Conversion to an array or record type. + assert(false && "Implement"); ---------------- erichkeane wrote:
same here. https://github.com/llvm/llvm-project/pull/112126 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits