diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2018-09-26 09:00:24 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2018-09-26 20:24:13 +0000 |
commit | 02ab36e220d8efa50cf42aa9b0a0b6f9986220a3 (patch) | |
tree | 0daa779b4ec223a05329a9aa03e6b630a9b19f08 /libmemunreachable | |
parent | c105f4b63afdac234c8682deca1028cf244f848b (diff) | |
download | system_core-02ab36e220d8efa50cf42aa9b0a0b6f9986220a3.tar.gz system_core-02ab36e220d8efa50cf42aa9b0a0b6f9986220a3.tar.bz2 system_core-02ab36e220d8efa50cf42aa9b0a0b6f9986220a3.zip |
Do not construct std::function with Allocator argument
Bug: http://b/116702964
This breaks when built with C++17, where these constructors are removed.
Looks like libc++ ignored the allocator arguments anyway - so this
should be NFC even with C++17.
Test: memunreachable_test on the host and Sailfish with C++14, C++17
Change-Id: I638326a900781f64d0562b5ec38e990659967039
Diffstat (limited to 'libmemunreachable')
-rw-r--r-- | libmemunreachable/HeapWalker.h | 2 | ||||
-rw-r--r-- | libmemunreachable/LeakFolding.cpp | 2 | ||||
-rw-r--r-- | libmemunreachable/ScopedSignalHandler.h | 6 |
3 files changed, 4 insertions, 6 deletions
diff --git a/libmemunreachable/HeapWalker.h b/libmemunreachable/HeapWalker.h index 5c7ec136b..92a832585 100644 --- a/libmemunreachable/HeapWalker.h +++ b/libmemunreachable/HeapWalker.h @@ -52,7 +52,7 @@ class HeapWalker { allocation_bytes_(0), roots_(allocator), root_vals_(allocator), - segv_handler_(allocator), + segv_handler_(), walking_ptr_(0) { valid_allocations_range_.end = 0; valid_allocations_range_.begin = ~valid_allocations_range_.end; diff --git a/libmemunreachable/LeakFolding.cpp b/libmemunreachable/LeakFolding.cpp index 69f320cc7..074dc48dd 100644 --- a/libmemunreachable/LeakFolding.cpp +++ b/libmemunreachable/LeakFolding.cpp @@ -57,7 +57,7 @@ void LeakFolding::ComputeDAG() { } void LeakFolding::AccumulateLeaks(SCCInfo* dominator) { - std::function<void(SCCInfo*)> walk(std::allocator_arg, allocator_, [&](SCCInfo* scc) { + std::function<void(SCCInfo*)> walk([&](SCCInfo* scc) { if (scc->accumulator != dominator) { scc->accumulator = dominator; dominator->cuumulative_size += scc->size; diff --git a/libmemunreachable/ScopedSignalHandler.h b/libmemunreachable/ScopedSignalHandler.h index ff53fad8f..9e08a8ecc 100644 --- a/libmemunreachable/ScopedSignalHandler.h +++ b/libmemunreachable/ScopedSignalHandler.h @@ -32,15 +32,14 @@ class ScopedSignalHandler { public: using Fn = std::function<void(ScopedSignalHandler&, int, siginfo_t*, void*)>; - explicit ScopedSignalHandler(Allocator<Fn> allocator) : allocator_(allocator), signal_(-1) {} + explicit ScopedSignalHandler() : signal_(-1) {} ~ScopedSignalHandler() { reset(); } template <class F> void install(int signal, F&& f) { if (signal_ != -1) MEM_LOG_ALWAYS_FATAL("ScopedSignalHandler already installed"); - handler_ = SignalFn(std::allocator_arg, allocator_, - [=](int signal, siginfo_t* si, void* uctx) { f(*this, signal, si, uctx); }); + handler_ = SignalFn([=](int signal, siginfo_t* si, void* uctx) { f(*this, signal, si, uctx); }); struct sigaction act {}; act.sa_sigaction = [](int signal, siginfo_t* si, void* uctx) { handler_(signal, si, uctx); }; @@ -68,7 +67,6 @@ class ScopedSignalHandler { private: using SignalFn = std::function<void(int, siginfo_t*, void*)>; DISALLOW_COPY_AND_ASSIGN(ScopedSignalHandler); - Allocator<Fn> allocator_; int signal_; struct sigaction old_act_; // TODO(ccross): to support multiple ScopedSignalHandlers handler_ would need |