================
@@ -12,16 +12,17 @@
using namespace llvm;
using namespace llvm::abi;
-FunctionInfo *FunctionInfo::create(CallingConv::ID CC, const Type *ReturnType,
- ArrayRef<const Type *> ArgTypes,
- std::optional<unsigned> NumRequired) {
+std::unique_ptr<FunctionInfo>
+FunctionInfo::create(CallingConv::ID CC, const Type *ReturnType,
+ ArrayRef<const Type *> ArgTypes,
+ std::optional<unsigned> NumRequired) {
assert(!NumRequired || *NumRequired <= ArgTypes.size());
void *Buffer = operator new(totalSizeToAlloc<ArgEntry>(ArgTypes.size()));
- FunctionInfo *FI =
- new (Buffer) FunctionInfo(CC, ReturnType, ArgTypes.size(), NumRequired);
+ std::unique_ptr<FunctionInfo> FI(
----------------
efriedma-quic wrote:
Is this actually legal? The pointer points to a memory buffer of the wrong
size; plain `delete` has undefined behavior, I think.
You can specify a custom deleter to do the right thing (instead
std::default_delete).
https://github.com/llvm/llvm-project/pull/196603
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits