Currently, when encountering an overridden new operator, the StaticAnalyzer will inline it when possible, while an overridden delete operator will never be, which leads us to false positives like the following:
struct CustomOperators { void *operator new(size_t count) { return malloc(count); } void operator delete(void *addr) { free(addr); } }; void compliant() { auto *a = new CustomOperators(); delete a; // warning{{Potential leak of memory pointed to by 'a'}} }
This patch restores the symmetry between how operator new and operator delete are handled by also inlining the content of operator delete when possible.
I think we could use the variadic isa template .