Commit 91d1b80f by Jim Stichnoth

Subzero: Add missing content to CfgLocalAllocator.

The std::list<> implementation used by g++ needs some extra stuff defined in the custom allocator. This can be smoke-tested with: make -f Makefile.standalone CXX=g++ LLVM_EXTRA_WARNINGS="-Wno-unknown-pragmas -Wno-unused-parameter -Wno-comment -Wno-enum-compare -Wno-strict-aliasing" STDLIB_FLAGS= until the link fails for unrelated reasons. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4325 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1367403004 .
parent 238b4c16
......@@ -80,12 +80,22 @@ ArenaAllocator<> *getCurrentCfgAllocator();
template <typename T> struct CfgLocalAllocator {
using value_type = T;
using pointer = T *;
using const_pointer = const T *;
using reference = T &;
using const_reference = const T &;
using size_type = std::size_t;
CfgLocalAllocator() = default;
template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {}
T *allocate(std::size_t Num) {
pointer allocate(size_type Num) {
return getCurrentCfgAllocator()->Allocate<T>(Num);
}
void deallocate(T *, std::size_t) {}
void deallocate(pointer, size_type) {}
template <class U> struct rebind { typedef CfgLocalAllocator<U> other; };
void construct(pointer P, const T &Val) {
new (static_cast<void *>(P)) T(Val);
}
void destroy(pointer P) { P->~T(); }
};
template <typename T, typename U>
inline bool operator==(const CfgLocalAllocator<T> &,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment