Author: nico Date: Sun Sep 20 13:10:46 2015 New Revision: 248129 URL: http://llvm.org/viewvc/llvm-project?rev=248129&view=rev Log: Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.
libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs rebind(), construct(), destroy(). MSVC2013 also has no snprintf, but it exists in 2015. Modified: libcxxabi/trunk/src/cxa_demangle.cpp Modified: libcxxabi/trunk/src/cxa_demangle.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=248129&r1=248128&r2=248129&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_demangle.cpp (original) +++ libcxxabi/trunk/src/cxa_demangle.cpp Sun Sep 20 13:10:46 2015 @@ -18,6 +18,13 @@ #include <cstring> #include <cctype> +#ifdef _MSC_VER +// snprintf is implemented in VS 2015 +#if _MSC_VER < 1900 +#define snprintf _snprintf_s +#endif +#endif + namespace __cxxabiv1 { @@ -4818,6 +4825,12 @@ class malloc_alloc { public: typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T* pointer; + typedef const T* const_pointer; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; malloc_alloc() = default; template <class U> malloc_alloc(const malloc_alloc<U>&) noexcept {} @@ -4830,6 +4843,17 @@ public: { std::free(p); } + + template <class U> struct rebind { using other = malloc_alloc<U>; }; + template <class U, class... Args> + void construct(U* p, Args&&... args) + { + ::new ((void*)p) U(std::forward<Args>(args)...); + } + void destroy(T* p) + { + p->~T(); + } }; template <class T, class U> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits