On Fri, Sep 19, 2014 at 11:09 AM, Kostya Serebryany <[email protected]> wrote:
> Richard,
> When using expr->getOperatorNew()->isReplaceableGlobalAllocationFunction()
> we don't handle operator new defined inside a class (see below).
> Using expr->getNumPlacementArgs() == 0 fixes that but breaks new
> (std::nothrow) X[n].
>
> Would you suggest another check that will include all non-placement
> operator new cases?
>
(Discussed offline. For posterity:)
Applying this check to class-specific operator new[] doesn't seem correct
in general; the class might in principle track values it has returned from
::operator new[] and provide access to / recycle them by some mechanism
other than calling ::operator delete[].
#include <new>
> #include <stdlib.h>
> class Foo {
> public:
> #ifdef OPN
> void *operator new(size_t s);
> void *operator new[] (size_t s);
> #endif
> ~Foo();
> };
>
> Foo *getFoo(size_t s) {
> return new Foo[s];
> }
>
>
>
> On Mon, Aug 25, 2014 at 6:33 PM, Richard Smith <[email protected]>
> wrote:
>
>> LGTM
>>
>> http://reviews.llvm.org/D4774
>>
>>
>>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits