mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-12 22:28:22 +00:00
Fix ItaniumDemangle.cpp build with MSVC 2013
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f73cd14f4a
commit
6b15e984c4
@ -7,7 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
#include "llvm/Demangle/Demangle.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
||||
// This file exports a single function: llvm::itanium_demangle.
|
||||
// It also has no dependencies on the rest of llvm. It is implemented this way
|
||||
@ -4211,27 +4212,27 @@ static void demangle(const char *first, const char *last, C &db, int &status) {
|
||||
namespace {
|
||||
template <std::size_t N> class arena {
|
||||
static const std::size_t alignment = 16;
|
||||
alignas(alignment) char buf_[N];
|
||||
LLVM_ALIGNAS(16) char buf_[N];
|
||||
char *ptr_;
|
||||
|
||||
std::size_t align_up(std::size_t n) noexcept {
|
||||
std::size_t align_up(std::size_t n) LLVM_NOEXCEPT {
|
||||
return (n + (alignment - 1)) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
bool pointer_in_buffer(char *p) noexcept {
|
||||
bool pointer_in_buffer(char *p) LLVM_NOEXCEPT {
|
||||
return buf_ <= p && p <= buf_ + N;
|
||||
}
|
||||
|
||||
public:
|
||||
arena() noexcept : ptr_(buf_) {}
|
||||
arena() LLVM_NOEXCEPT : ptr_(buf_) {}
|
||||
~arena() { ptr_ = nullptr; }
|
||||
arena(const arena &) = delete;
|
||||
arena &operator=(const arena &) = delete;
|
||||
|
||||
char *allocate(std::size_t n);
|
||||
void deallocate(char *p, std::size_t n) noexcept;
|
||||
void deallocate(char *p, std::size_t n) LLVM_NOEXCEPT;
|
||||
|
||||
static constexpr std::size_t size() { return N; }
|
||||
static LLVM_CONSTEXPR std::size_t size() { return N; }
|
||||
std::size_t used() const { return static_cast<std::size_t>(ptr_ - buf_); }
|
||||
void reset() { ptr_ = buf_; }
|
||||
};
|
||||
@ -4247,7 +4248,7 @@ template <std::size_t N> char *arena<N>::allocate(std::size_t n) {
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
void arena<N>::deallocate(char *p, std::size_t n) noexcept {
|
||||
void arena<N>::deallocate(char *p, std::size_t n) LLVM_NOEXCEPT {
|
||||
if (pointer_in_buffer(p)) {
|
||||
n = align_up(n);
|
||||
if (p + n == ptr_)
|
||||
@ -4265,35 +4266,35 @@ public:
|
||||
public:
|
||||
template <class _Up> struct rebind { typedef short_alloc<_Up, N> other; };
|
||||
|
||||
short_alloc(arena<N> &a) noexcept : a_(a) {}
|
||||
short_alloc(arena<N> &a) LLVM_NOEXCEPT : a_(a) {}
|
||||
template <class U>
|
||||
short_alloc(const short_alloc<U, N> &a) noexcept : a_(a.a_) {}
|
||||
short_alloc(const short_alloc<U, N> &a) LLVM_NOEXCEPT : a_(a.a_) {}
|
||||
short_alloc(const short_alloc &) = default;
|
||||
short_alloc &operator=(const short_alloc &) = delete;
|
||||
|
||||
T *allocate(std::size_t n) {
|
||||
return reinterpret_cast<T *>(a_.allocate(n * sizeof(T)));
|
||||
}
|
||||
void deallocate(T *p, std::size_t n) noexcept {
|
||||
void deallocate(T *p, std::size_t n) LLVM_NOEXCEPT {
|
||||
a_.deallocate(reinterpret_cast<char *>(p), n * sizeof(T));
|
||||
}
|
||||
|
||||
template <class T1, std::size_t N1, class U, std::size_t M>
|
||||
friend bool operator==(const short_alloc<T1, N1> &x,
|
||||
const short_alloc<U, M> &y) noexcept;
|
||||
const short_alloc<U, M> &y) LLVM_NOEXCEPT;
|
||||
|
||||
template <class U, std::size_t M> friend class short_alloc;
|
||||
};
|
||||
|
||||
template <class T, std::size_t N, class U, std::size_t M>
|
||||
inline bool operator==(const short_alloc<T, N> &x,
|
||||
const short_alloc<U, M> &y) noexcept {
|
||||
const short_alloc<U, M> &y) LLVM_NOEXCEPT {
|
||||
return N == M && &x.a_ == &y.a_;
|
||||
}
|
||||
|
||||
template <class T, std::size_t N, class U, std::size_t M>
|
||||
inline bool operator!=(const short_alloc<T, N> &x,
|
||||
const short_alloc<U, M> &y) noexcept {
|
||||
const short_alloc<U, M> &y) LLVM_NOEXCEPT {
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
@ -4308,12 +4309,12 @@ public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
malloc_alloc() = default;
|
||||
template <class U> malloc_alloc(const malloc_alloc<U> &) noexcept {}
|
||||
template <class U> malloc_alloc(const malloc_alloc<U> &) LLVM_NOEXCEPT {}
|
||||
|
||||
T *allocate(std::size_t n) {
|
||||
return static_cast<T *>(std::malloc(n * sizeof(T)));
|
||||
}
|
||||
void deallocate(T *p, std::size_t) noexcept { std::free(p); }
|
||||
void deallocate(T *p, std::size_t) LLVM_NOEXCEPT { std::free(p); }
|
||||
|
||||
template <class U> struct rebind { using other = malloc_alloc<U>; };
|
||||
template <class U, class... Args> void construct(U *p, Args &&... args) {
|
||||
@ -4324,13 +4325,13 @@ public:
|
||||
|
||||
template <class T, class U>
|
||||
inline bool operator==(const malloc_alloc<T> &,
|
||||
const malloc_alloc<U> &) noexcept {
|
||||
const malloc_alloc<U> &) LLVM_NOEXCEPT {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline bool operator!=(const malloc_alloc<T> &x,
|
||||
const malloc_alloc<U> &y) noexcept {
|
||||
const malloc_alloc<U> &y) LLVM_NOEXCEPT {
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user