This is an archive of the discontinued LLVM Phabricator instance.

scoped alloc construct: adds basic tests
AbandonedPublic

Authored by frutiger on Feb 7 2016, 10:56 AM.

Details

Reviewers
mclow.lists
Summary

This commit introduces a new supporting allocator 'IA1' in
'support/instrumentingallocators.h' which tracks allocations and deallocations.

This commit also introduces a new test driver 'construct.pass.cpp' which tests
using the 'scoped_allocator_adaptor' with three types which take allocators in
different ways:

  1. container-style with the allocator at the end
  2. std::function-style with the allocator at the start
  3. allocator-unaware types

This will provide a starting point for scenarios where argument lists need to
be adapted before being forwarded for 'pair<T1, T2>' where 'T1' and 'T2' may be
combinations of the above three classes of types.

Diff Detail

Event Timeline

frutiger updated this revision to Diff 47140.Feb 7 2016, 10:56 AM
frutiger retitled this revision from to scoped alloc construct: adds basic tests.
frutiger updated this object.
frutiger added reviewers: EricWF, mclow.lists.
frutiger added a subscriber: cfe-commits.
frutiger updated this revision to Diff 47141.EditedFeb 7 2016, 11:07 AM

Added operator== and operator!=, and an assertion in the instrumentation to check for no outstanding allocations.

AlisdairM added inline comments.
test/support/instrumentingallocators.h
25

Perhaps a loop, showing what leaked?

for (auto const& alloc : allocs_) {

std::cout << "leaked: address(" << alloc.first <<)  size(" << alloc.second << ")\n";

}

frutiger updated this revision to Diff 47143.Feb 7 2016, 11:22 AM

Fixes include guards.

EricWF resigned from this revision.Dec 30 2016, 3:06 AM
EricWF removed a reviewer: EricWF.
frutiger abandoned this revision.Oct 23 2017, 4:28 PM

@AlisdairM maybe you want to commandeer this revision? I don't think this is going anywhere...