summaryrefslogtreecommitdiff
path: root/lib/Demangle
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-09-06 19:39:56 +0000
committerReid Kleckner <rnk@google.com>2016-09-06 19:39:56 +0000
commit6b15e984c4284f9f18a72d73e5f8f217e312d4da (patch)
treecfb51c0d7bc86d9ce9eae0462a1f3340c7fafb09 /lib/Demangle
parentf73cd14f4ac0760ec70f0917f928f1d5a23dba75 (diff)
Fix ItaniumDemangle.cpp build with MSVC 2013
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Demangle')
-rw-r--r--lib/Demangle/ItaniumDemangle.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/Demangle/ItaniumDemangle.cpp b/lib/Demangle/ItaniumDemangle.cpp
index ff533f632b2..d261aa078f0 100644
--- a/lib/Demangle/ItaniumDemangle.cpp
+++ b/lib/Demangle/ItaniumDemangle.cpp
@@ -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);
}