Call a constructor on a pointer in Sema

I’m trying to create a wrapper function that takes a pointer and essentially calls placement new on it. Is it possible to generate AST for this in Sema instead of generating llvm directly in CodeGen?

I cannot just use placement new because it is not implicitly defined and users may write their own definition of it.

Users are not allowed to override the reserved placement new function, i.e. the one that just takes a void*, and Clang will not actually call it if they try. But you’re right that it’s not implicitly declared like the non-placement operator new is.

It wouldn’t be completely ridiculous to allow CXXNewExpr to not contain an operator new, but you could probably also just fake one up that will satisfy isReservedGlobalPlacementOperator(). If this is destined to go in-tree, though, there might be better options.

John.