[clang] [clang][Interp] Implement dynamic memory allocation handling (PR #70306)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 21:30:47 PDT 2024
================
@@ -2771,6 +2771,109 @@ bool Compiler<Emitter>::VisitCXXInheritedCtorInitExpr(
return this->emitCall(F, 0, E);
}
+template <class Emitter>
+bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
+ assert(classifyPrim(E->getType()) == PT_Ptr);
+ const Expr *Init = E->getInitializer();
+ QualType ElementType = E->getAllocatedType();
+ std::optional<PrimType> ElemT = classify(ElementType);
+ unsigned PlacementArgs = E->getNumPlacementArgs();
+ bool IsNoThrow = false;
+
+ // FIXME: Better diagnostic. diag::note_constexpr_new_placement
+ if (PlacementArgs != 0) {
+ // The only new-placement list we support is of the form (std::nothrow).
+ //
+ // FIXME: There is no restriction on this, but it's not clear that any
+ // other form makes any sense. We get here for cases such as:
----------------
tbaederr wrote:
Yep, I saw. I'll wait for @cor3ntin to come up with the test cases though :)
https://github.com/llvm/llvm-project/pull/70306
More information about the cfe-commits
mailing list