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 .
diff --git a/src/IceDefs.h b/src/IceDefs.h
index 5f96d7e..f58ebe9 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -80,12 +80,22 @@
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> &,