Dear All,
I would like to propose a patch to fix the Bug34144[https://bugs.llvm.org/show_bug.cgi?id=34144].
Bug34144 mainly because MallocChecker assumes that the pointer returned by CXXNewExpr can't be null.
However, in some cases, c++ allocator may return a Null pointer, and when 'c++-allocator-inlining'
config option sets true, the CXXNewExpr may bind a Null Pointer. This will trigger an assertion failure
in MallocChecker::MallocUpdateRefState().
Given the below code sippet:
#include <new>
void *operator new(std::size_t, const std::nothrow_t&) noexcept
{
return 0;
}
int main()
{
int *i = new(std::nothrow) int(1);
delete i;
return 0;
}Please let me know if this is an acceptable change.
Regards,
Henry Wong
I think that within this branch we can/should assert that E is indeed a custom operator new call.