Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern "C" {
- extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__));
- }
- typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
- typedef __typeof__(sizeof(int)) size_t;
- namespace std __attribute__ ((__visibility__ ("default"))) {
- }
- extern "C" {
- extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));
- extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
- extern size_t strlen (__const char *__s) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _Tp> inline void swap(_Tp& __a, _Tp& __b) {
- _Tp __tmp = (__a);
- __a = (__b);
- __b = (__tmp);
- }
- template<class _T1, class _T2> struct pair {
- typedef _T1 first_type;
- typedef _T2 second_type;
- _T1 first;
- _T2 second;
- pair() : first(), second() {
- }
- pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {
- }
- template<class _U1, class _U2> pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {
- }
- };
- template<class _T1, class _T2> inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) {
- return pair<_T1, _T2>(__x, __y);
- }
- template<typename _Alloc> class allocator;
- template<class _CharT> struct char_traits;
- template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string;
- typedef basic_string<char> string;
- void __throw_bad_alloc(void) __attribute__((__noreturn__));
- void __throw_length_error(const char*) __attribute__((__noreturn__));
- void __throw_out_of_range(const char*) __attribute__((__noreturn__));
- }
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- template<typename _Iterator, typename _Container> class __normal_iterator;
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- struct __true_type {
- };
- struct __false_type {
- };
- template<typename, typename> struct __are_same {
- enum {
- __value = 0 };
- typedef __false_type __type;
- };
- template<typename _Tp> struct __is_integer {
- enum {
- __value = 0 };
- typedef __false_type __type;
- };
- }
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- template<bool _Cond, typename _Iftrue, typename _Iffalse> struct __conditional_type {
- typedef _Iftrue __type;
- };
- }
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- template<typename _Value> struct __numeric_traits_integer {
- static const _Value __min = (((_Value)(-1) < 0) ? (_Value)1 << (sizeof(_Value) * 8 - ((_Value)(-1) < 0)) : (_Value)0);
- static const _Value __max = (((_Value)(-1) < 0) ? (((((_Value)1 << ((sizeof(_Value) * 8 - ((_Value)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(_Value)0);
- static const bool __is_signed = ((_Value)(-1) < 0);
- static const int __digits = (sizeof(_Value) * 8 - ((_Value)(-1) < 0));
- };
- template<typename _Value> struct __numeric_traits_floating {
- static const int __max_digits10 = (2 + (std::__are_same<_Value, float>::__value ? 24 : std::__are_same<_Value, double>::__value ? 53 : 64) * 3010 / 10000);
- static const bool __is_signed = true;
- static const int __digits10 = (std::__are_same<_Value, float>::__value ? 6 : std::__are_same<_Value, double>::__value ? 15 : 18);
- static const int __max_exponent10 = (std::__are_same<_Value, float>::__value ? 38 : std::__are_same<_Value, double>::__value ? 308 : 4932);
- };
- template<typename _Value> struct __numeric_traits : public __conditional_type<std::__is_integer<_Value>::__value, __numeric_traits_integer<_Value>, __numeric_traits_floating<_Value> >::__type {
- };
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- struct input_iterator_tag {
- };
- struct forward_iterator_tag : public input_iterator_tag {
- };
- template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
- };
- template<typename _Iterator> struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
- };
- template<typename _Iter> inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
- return typename iterator_traits<_Iter>::iterator_category();
- }
- template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) {
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- while (__first != __last) {
- ++__first;
- ++__n;
- }
- return __n;
- }
- template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) {
- return std::__distance(__first, __last, std::__iterator_category(__first));
- }
- template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> {
- protected: _Iterator current;
- public: typedef _Iterator iterator_type;
- typedef typename iterator_traits<_Iterator>::difference_type difference_type;
- typedef typename iterator_traits<_Iterator>::reference reference;
- typedef typename iterator_traits<_Iterator>::pointer pointer;
- public: reverse_iterator() : current() {
- }
- explicit reverse_iterator(iterator_type __x) : current(__x) {
- }
- reverse_iterator(const reverse_iterator& __x) : current(__x.current) {
- }
- template<typename _Iter> reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {
- }
- iterator_type base() const {
- return current;
- }
- reference operator*() const {
- _Iterator __tmp = current;
- }
- reverse_iterator operator+(difference_type __n) const {
- return reverse_iterator(current - __n);
- }
- reverse_iterator& operator+=(difference_type __n) {
- current -= __n;
- return *this;
- }
- reverse_iterator operator-(difference_type __n) const {
- return reverse_iterator(current + __n);
- }
- reverse_iterator& operator-=(difference_type __n) {
- current += __n;
- return *this;
- }
- reference operator[](difference_type __n) const {
- return *(*this + __n);
- }
- };
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
- if (__b < __a) return __b;
- return __a;
- }
- template<typename _Tp, typename _Compare> inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
- if (__comp(__a, __b)) return __b;
- return __a;
- }
- }
- typedef struct {
- }
- __mbstate_t;
- typedef __mbstate_t mbstate_t;
- namespace std __attribute__ ((__visibility__ ("default"))) {
- typedef long streamoff;
- template<typename _StateT> class fpos {
- private: streamoff _M_off;
- _StateT _M_state;
- public: fpos() : _M_off(0), _M_state() {
- }
- fpos(streamoff __off) : _M_off(__off), _M_state() {
- }
- operator streamoff() const {
- return _M_off;
- }
- void state(_StateT __st) {
- _M_state = __st;
- }
- _StateT state() const {
- return _M_state;
- }
- fpos& operator+=(streamoff __off) {
- _M_off += __off;
- return *this;
- }
- fpos& operator-=(streamoff __off) {
- _M_off -= __off;
- return *this;
- }
- fpos operator+(streamoff __off) const {
- fpos __pos(*this);
- __pos += __off;
- return __pos;
- }
- fpos operator-(streamoff __off) const {
- fpos __pos(*this);
- __pos -= __off;
- return __pos;
- }
- streamoff operator-(const fpos& __other) const {
- return _M_off - __other._M_off;
- }
- };
- typedef fpos<mbstate_t> streampos;
- }
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<> struct char_traits<char> {
- typedef char char_type;
- typedef int int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
- typedef mbstate_t state_type;
- static void assign(char_type& __c1, const char_type& __c2) {
- __c1 = __c2;
- }
- static bool eq(const char_type& __c1, const char_type& __c2) {
- return __c1 == __c2;
- }
- static bool lt(const char_type& __c1, const char_type& __c2) {
- return __c1 < __c2;
- }
- static int compare(const char_type* __s1, const char_type* __s2, size_t __n) {
- return __builtin_memcmp(__s1, __s2, __n);
- }
- static size_t length(const char_type* __s) {
- return __builtin_strlen(__s);
- }
- static char_type to_char_type(const int_type& __c) {
- return static_cast<char_type>(__c);
- }
- static int_type to_int_type(const char_type& __c) {
- return static_cast<int_type>(static_cast<unsigned char>(__c));
- }
- static bool eq_int_type(const int_type& __c1, const int_type& __c2) {
- return __c1 == __c2;
- }
- static int_type eof() {
- return static_cast<int_type>((-1));
- }
- static int_type not_eof(const int_type& __c) {
- return (__c == eof()) ? 0 : __c;
- }
- };
- }
- extern "C++" {
- namespace std {
- class exception {
- public: exception() throw() {
- }
- virtual ~exception() throw();
- virtual const char* what() const throw();
- };
- class bad_exception : public exception {
- public: bad_exception() throw() {
- }
- virtual ~bad_exception() throw();
- virtual const char* what() const throw();
- };
- typedef void (*terminate_handler) ();
- typedef void (*unexpected_handler) ();
- terminate_handler set_terminate(terminate_handler) throw();
- void terminate() __attribute__ ((__noreturn__));
- unexpected_handler set_unexpected(unexpected_handler) throw();
- void unexpected() __attribute__ ((__noreturn__));
- void __verbose_terminate_handler();
- }
- }
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- template<typename _Tp> class new_allocator {
- public: typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
- template<typename _Tp1> struct rebind {
- typedef new_allocator<_Tp1> other;
- };
- new_allocator() throw() {
- }
- new_allocator(const new_allocator&) throw() {
- }
- template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) throw() {
- }
- ~new_allocator() throw() {
- }
- pointer address(reference __x) const {
- return &__x;
- }
- const_pointer address(const_reference __x) const {
- return &__x;
- }
- pointer allocate(size_type __n, const void* = 0) {
- }
- void destroy(pointer __p) {
- __p->~_Tp();
- }
- };
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
- public: typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
- template<typename _Tp1> struct rebind {
- typedef allocator<_Tp1> other;
- };
- allocator() throw() {
- }
- allocator(const allocator& __a) throw() : __gnu_cxx::new_allocator<_Tp>(__a) {
- }
- template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() {
- }
- ~allocator() throw() {
- }
- };
- template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_swap {
- static void _S_do_it(_Alloc&, _Alloc&) {
- }
- };
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function {
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
- };
- template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const {
- return __x < __y;
- }
- };
- }
- typedef struct {
- }
- cpu_set_t;
- typedef long int __jmp_buf[8];
- extern "C" {
- typedef struct {
- struct {
- __jmp_buf __cancel_jmp_buf;
- int __mask_was_saved;
- }
- __cancel_jmp_buf[1];
- void *__pad[4];
- }
- __pthread_unwind_buf_t __attribute__ ((__aligned__));
- }
- static inline int __gthread_active_p (void) {
- }
- typedef int _Atomic_word;
- namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
- static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) {
- return __sync_fetch_and_add(__mem, __val);
- }
- static inline void __atomic_add(volatile _Atomic_word* __mem, int __val) {
- __sync_fetch_and_add(__mem, __val);
- }
- static inline _Atomic_word __exchange_and_add_single(_Atomic_word* __mem, int __val) {
- _Atomic_word __result = *__mem;
- *__mem += __val;
- return __result;
- }
- static inline void __atomic_add_single(_Atomic_word* __mem, int __val) {
- *__mem += __val;
- }
- static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) {
- if (__gthread_active_p()) return __exchange_and_add(__mem, __val);
- else return __exchange_and_add_single(__mem, __val);
- }
- static inline void __attribute__ ((__unused__)) __atomic_add_dispatch(_Atomic_word* __mem, int __val) {
- if (__gthread_active_p()) __atomic_add(__mem, __val);
- else __atomic_add_single(__mem, __val);
- }
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
- typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
- public: typedef _Traits traits_type;
- typedef typename _Traits::char_type value_type;
- typedef _Alloc allocator_type;
- typedef typename _CharT_alloc_type::size_type size_type;
- typedef typename _CharT_alloc_type::difference_type difference_type;
- typedef typename _CharT_alloc_type::reference reference;
- typedef typename _CharT_alloc_type::const_reference const_reference;
- typedef typename _CharT_alloc_type::pointer pointer;
- typedef typename _CharT_alloc_type::const_pointer const_pointer;
- typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
- typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- private: struct _Rep_base {
- size_type _M_length;
- size_type _M_capacity;
- _Atomic_word _M_refcount;
- };
- struct _Rep : _Rep_base {
- typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
- static const size_type _S_max_size;
- static const _CharT _S_terminal;
- static size_type _S_empty_rep_storage[];
- static _Rep& _S_empty_rep() {
- void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
- return *reinterpret_cast<_Rep*>(__p);
- }
- bool _M_is_leaked() const {
- return this->_M_refcount < 0;
- }
- bool _M_is_shared() const {
- return this->_M_refcount > 0;
- }
- void _M_set_leaked() {
- this->_M_refcount = -1;
- }
- void _M_set_sharable() {
- this->_M_refcount = 0;
- }
- void _M_set_length_and_sharable(size_type __n) {
- this->_M_set_sharable();
- this->_M_length = __n;
- traits_type::assign(this->_M_refdata()[__n], _S_terminal);
- }
- _CharT* _M_refdata() throw() {
- return _M_refdata();
- }
- _CharT* _M_clone(const _Alloc&, size_type __res = 0);
- };
- struct _Alloc_hider : _Alloc {
- _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) {
- }
- _CharT* _M_p;
- };
- public: static const size_type npos = static_cast<size_type>(-1);
- private: mutable _Alloc_hider _M_dataplus;
- _CharT* _M_data() const {
- return _M_dataplus._M_p;
- }
- _CharT* _M_data(_CharT* __p) {
- return (_M_dataplus._M_p = __p);
- }
- _Rep* _M_rep() const {
- return &((reinterpret_cast<_Rep*> (_M_data()))[-1]);
- }
- iterator _M_ibegin() const {
- return iterator(_M_data());
- }
- iterator _M_iend() const {
- return iterator(_M_data() + this->size());
- }
- void _M_leak() {
- if (!_M_rep()->_M_is_leaked()) _M_leak_hard();
- }
- size_type _M_check(size_type __pos, const char* __s) const {
- if (__pos > this->size()) __throw_out_of_range((__s));
- return __pos;
- }
- void _M_check_length(size_type __n1, size_type __n2, const char* __s) const {
- if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error((__s));
- }
- size_type _M_limit(size_type __pos, size_type __off) const {
- const bool __testoff = __off < this->size() - __pos;
- return __testoff ? __off : this->size() - __pos;
- }
- bool _M_disjunct(const _CharT* __s) const {
- return (less<const _CharT*>()(__s, _M_data()) || less<const _CharT*>()(_M_data() + this->size(), __s));
- }
- static void _M_copy(_CharT* __d, const _CharT* __s, size_type __n) {
- if (__n == 1) traits_type::assign(*__d, *__s);
- else traits_type::copy(__d, __s, __n);
- }
- static void _M_move(_CharT* __d, const _CharT* __s, size_type __n) {
- if (__n == 1) traits_type::assign(*__d, *__s);
- else traits_type::move(__d, __s, __n);
- }
- static void _M_assign(_CharT* __d, size_type __n, _CharT __c) {
- if (__n == 1) traits_type::assign(*__d, __c);
- else traits_type::assign(__d, __n, __c);
- }
- template<class _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) {
- _M_copy(__p, __k1, __k2 - __k1);
- }
- static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) {
- _M_copy(__p, __k1, __k2 - __k1);
- }
- static int _S_compare(size_type __n1, size_type __n2) {
- const difference_type __d = difference_type(__n1 - __n2);
- if (__d > __gnu_cxx::__numeric_traits<int>::__max) return __gnu_cxx::__numeric_traits<int>::__max;
- else if (__d < __gnu_cxx::__numeric_traits<int>::__min) return __gnu_cxx::__numeric_traits<int>::__min;
- else return int(__d);
- }
- void _M_mutate(size_type __pos, size_type __len1, size_type __len2);
- void _M_leak_hard();
- static _Rep& _S_empty_rep() {
- return _Rep::_S_empty_rep();
- }
- public: inline basic_string();
- explicit basic_string(const _Alloc& __a);
- basic_string(const basic_string& __str);
- basic_string(const basic_string& __str, size_type __pos, size_type __n = npos);
- basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a);
- basic_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc());
- basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
- basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
- iterator begin() {
- _M_leak();
- return iterator(_M_data());
- }
- const_iterator begin() const {
- return const_iterator(_M_data());
- }
- iterator end() {
- _M_leak();
- return iterator(_M_data() + this->size());
- }
- const_iterator end() const {
- return const_iterator(_M_data() + this->size());
- }
- reverse_iterator rbegin() {
- return reverse_iterator(this->end());
- }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(this->end());
- }
- reverse_iterator rend() {
- return reverse_iterator(this->begin());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(this->begin());
- }
- public: size_type size() const {
- return _M_rep()->_M_length;
- }
- size_type length() const {
- return _M_rep()->_M_length;
- _M_mutate(0, this->size(), 0);
- }
- bool empty() const {
- return this->size() == 0;
- }
- const_reference operator[] (size_type __pos) const {
- ;
- return _M_data()[__pos];
- }
- const_reference at(size_type __n) const {
- if (__n >= this->size()) __throw_out_of_range(("basic_string::at"));
- return _M_data()[__n];
- }
- reference at(size_type __n) {
- if (__n >= size()) __throw_out_of_range(("basic_string::at"));
- _M_leak();
- return _M_data()[__n];
- }
- basic_string& operator+=(const basic_string& __str) {
- return this->append(__str);
- }
- basic_string& operator+=(const _CharT* __s) {
- return this->append(__s);
- }
- basic_string& operator+=(_CharT __c) {
- this->push_back(__c);
- return *this;
- }
- basic_string& append(const basic_string& __str);
- basic_string& append(size_type __n, _CharT __c);
- template<class _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) {
- return this->replace(_M_iend(), _M_iend(), __first, __last);
- }
- void push_back(_CharT __c) {
- const size_type __len = 1 + this->size();
- if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len);
- traits_type::assign(_M_data()[this->size()], __c);
- _M_rep()->_M_set_length_and_sharable(__len);
- }
- basic_string& assign(const basic_string& __str);
- const _CharT* c_str() const {
- return _M_data();
- }
- const _CharT* data() const {
- return _M_data();
- }
- allocator_type get_allocator() const {
- return _M_dataplus;
- }
- size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const {
- return this->find_first_not_of(__str.data(), __pos, __str.size());
- }
- size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
- int compare(const basic_string& __str) const {
- const size_type __size = this->size();
- const size_type __osize = __str.size();
- const size_type __len = std::min(__size, __osize);
- int __r = traits_type::compare(_M_data(), __str.data(), __len);
- if (!__r) __r = _S_compare(__size, __osize);
- return __r;
- }
- int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const;
- };
- }
- namespace llvm {
- class StringRef {
- public: typedef const char *iterator;
- static const size_t npos = ~size_t(0);
- typedef size_t size_type;
- private: const char *Data;
- size_t Length;
- size_t min(size_t a, size_t b) const {
- return a < b ? a : b;
- }
- size_t max(size_t a, size_t b) const {
- return a > b ? a : b;
- }
- public: StringRef() : Data(0), Length(0) {
- }
- StringRef(const char *Str) : Data(Str), Length(::strlen(Str)) {
- }
- StringRef(const char *data, size_t length) : Data(data), Length(length) {
- }
- StringRef(const std::string &Str) : Data(Str.data()), Length(Str.length()) {
- }
- iterator begin() const {
- return Data;
- }
- iterator end() const {
- return Data + Length;
- }
- const char *data() const {
- return Data;
- }
- bool empty() const {
- return Length == 0;
- }
- size_t size() const {
- return Length;
- }
- char front() const {
- ((!empty()) ? static_cast<void> (0) : __assert_fail ("!empty()", "/usr/local/include/llvm/ADT/StringRef.h", 98, __PRETTY_FUNCTION__));
- return Data[0];
- }
- char back() const {
- ((!empty()) ? static_cast<void> (0) : __assert_fail ("!empty()", "/usr/local/include/llvm/ADT/StringRef.h", 104, __PRETTY_FUNCTION__));
- return Data[Length-1];
- }
- bool equals(StringRef RHS) const {
- return (Length == RHS.Length && memcmp(Data, RHS.Data, RHS.Length) == 0);
- }
- bool equals_lower(StringRef RHS) const {
- return Length == RHS.Length && compare_lower(RHS) == 0;
- }
- int compare(StringRef RHS) const {
- if (int Res = memcmp(Data, RHS.Data, min(Length, RHS.Length))) return Res < 0 ? -1 : 1;
- if (Length == RHS.Length) return 0;
- return Length < RHS.Length ? -1 : 1;
- }
- int compare_lower(StringRef RHS) const;
- std::string str() const {
- return std::string(Data, Length);
- }
- char operator[](size_t Index) const {
- ((Index < Length && "Invalid index!") ? static_cast<void> (0) : __assert_fail ("Index < Length && \"Invalid index!\"", "/usr/local/include/llvm/ADT/StringRef.h", 144, __PRETTY_FUNCTION__));
- return Data[Index];
- }
- operator std::string() const {
- return str();
- }
- bool startswith(StringRef Prefix) const {
- return substr(0, Prefix.Length).equals(Prefix);
- }
- bool endswith(StringRef Suffix) const {
- return slice(size() - Suffix.Length, size()).equals(Suffix);
- }
- size_t find(char C, size_t From = 0) const {
- for (size_t i = min(From, Length), e = Length;
- i != e;
- ++i) if (Data[i] == C) return i;
- return npos;
- }
- size_t find(StringRef Str, size_t From = 0) const;
- size_t rfind(char C, size_t From = npos) const {
- From = min(From, Length);
- size_t i = From;
- while (i != 0) {
- --i;
- if (Data[i] == C) return i;
- }
- return npos;
- }
- size_t rfind(StringRef Str) const;
- size_type find_first_of(char C, size_t = 0) const {
- return find(C);
- }
- StringRef substr(size_t Start, size_t N = npos) const {
- Start = min(Start, Length);
- return StringRef(Data + Start, min(N, Length - Start));
- }
- StringRef slice(size_t Start, size_t End) const {
- Start = min(Start, Length);
- End = min(max(Start, End), Length);
- return StringRef(Data + Start, End - Start);
- }
- std::pair<StringRef, StringRef> rsplit(char Separator) const {
- size_t Idx = rfind(Separator);
- if (Idx == npos) return std::make_pair(*this, StringRef());
- return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
- }
- };
- typedef int int64_t __attribute__ ((__mode__ (__DI__)));
- }
- typedef unsigned long int uint64_t;
- namespace llvm {
- class format_object_base;
- class raw_ostream {
- private: void operator=(const raw_ostream &);
- raw_ostream(const raw_ostream &);
- char *OutBufStart, *OutBufEnd, *OutBufCur;
- enum BufferKind {
- Unbuffered = 0, InternalBuffer, ExternalBuffer }
- BufferMode;
- bool Error;
- public: enum Colors {
- BLACK=0, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, SAVEDCOLOR };
- explicit raw_ostream(bool unbuffered=false) : BufferMode(unbuffered ? Unbuffered : InternalBuffer), Error(false) {
- OutBufStart = OutBufEnd = OutBufCur = 0;
- }
- virtual ~raw_ostream();
- uint64_t tell() {
- return current_pos() + GetNumBytesInBuffer();
- }
- bool has_error() const {
- return Error;
- }
- void clear_error() {
- Error = false;
- }
- void SetBuffered();
- void SetBufferSize(size_t Size) {
- flush();
- SetBufferAndMode(new char[Size], Size, InternalBuffer);
- }
- size_t GetBufferSize() {
- if (BufferMode != Unbuffered && OutBufStart == 0) return preferred_buffer_size();
- return OutBufEnd - OutBufStart;
- }
- void SetUnbuffered() {
- flush();
- SetBufferAndMode(0, 0, Unbuffered);
- }
- size_t GetNumBytesInBuffer() const {
- return OutBufCur - OutBufStart;
- }
- void flush() {
- if (OutBufCur != OutBufStart) flush_nonempty();
- }
- raw_ostream &operator<<(char C) {
- if (OutBufCur >= OutBufEnd) return write(C);
- *OutBufCur++ = C;
- return *this;
- }
- raw_ostream &operator<<(unsigned char C) {
- if (OutBufCur >= OutBufEnd) return write(C);
- *OutBufCur++ = C;
- return *this;
- }
- raw_ostream &operator<<(signed char C) {
- if (OutBufCur >= OutBufEnd) return write(C);
- *OutBufCur++ = C;
- return *this;
- }
- raw_ostream &operator<<(StringRef Str) {
- size_t Size = Str.size();
- if (OutBufCur+Size > OutBufEnd) return write(Str.data(), Size);
- memcpy(OutBufCur, Str.data(), Size);
- OutBufCur += Size;
- return *this;
- }
- raw_ostream &operator<<(const char *Str) {
- return this->operator<<(StringRef(Str));
- }
- raw_ostream &operator<<(const std::string &Str) {
- return write(Str.data(), Str.length());
- }
- raw_ostream &write_hex(unsigned long long N);
- raw_ostream &write_escaped(StringRef Str);
- raw_ostream &write(unsigned char C);
- raw_ostream &write(const char *Ptr, size_t Size);
- raw_ostream &operator<<(const format_object_base &Fmt);
- raw_ostream &indent(unsigned NumSpaces);
- virtual void write_impl(const char *Ptr, size_t Size) = 0;
- virtual void handle();
- virtual uint64_t current_pos() = 0;
- protected: void SetBuffer(char *BufferStart, size_t Size) {
- SetBufferAndMode(BufferStart, Size, ExternalBuffer);
- }
- virtual size_t preferred_buffer_size();
- void error_detected() {
- Error = true;
- }
- const char *getBufferStart() const {
- return OutBufStart;
- }
- private: void SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode);
- void flush_nonempty();
- void copy_to_buffer(const char *Ptr, size_t Size);
- ::new(static_cast<void*>(__p)) _T1(__value);
- }
- template<typename _Tp> inline void _Destroy(_Tp* __pointer) {
- __pointer->~_Tp();
- }
- template<bool> struct __uninitialized_fill_n {
- template<typename _ForwardIterator, typename _Size, typename _Tp> static void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
- _ForwardIterator __cur = __first;
- try {
- for (;
- __n > 0;
- --__n, ++__cur) std::_Construct(&*__cur, __x);
- }
- catch(...) {
- std::_Destroy(__first, __cur);
- throw;
- }
- }
- };
- template<typename _ForwardIterator, typename _Size, typename _Tp> inline void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
- typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
- std::__uninitialized_fill_n<__is_pod(_ValueType)>:: uninitialized_fill_n(__first, __n, __x);
- }
- template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> _ForwardIterator __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) {
- _ForwardIterator __cur = __result;
- try {
- for (;
- __first != __last;
- ++__first, ++__cur) __alloc.construct(&*__cur, *__first);
- return __cur;
- }
- catch(...) {
- std::_Destroy(__result, __cur, __alloc);
- throw;
- }
- }
- template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Tp2> inline void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, allocator<_Tp2>&) {
- std::uninitialized_fill_n(__first, __n, __x);
- }
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- template<typename _Tp, typename _Alloc> struct _Vector_base {
- typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
- struct _Vector_impl : public _Tp_alloc_type {
- typename _Tp_alloc_type::pointer _M_start;
- typename _Tp_alloc_type::pointer _M_finish;
- typename _Tp_alloc_type::pointer _M_end_of_storage;
- _Vector_impl() : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
- }
- _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
- }
- };
- public: typedef _Alloc allocator_type;
- _Tp_alloc_type& _M_get_Tp_allocator() {
- return *static_cast<_Tp_alloc_type*>(&this->_M_impl);
- }
- _Vector_base() : _M_impl() {
- }
- _Vector_base(const allocator_type& __a) : _M_impl(__a) {
- }
- _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) {
- }
- public: _Vector_impl _M_impl;
- typename _Tp_alloc_type::pointer _M_allocate(size_t __n) {
- return __n != 0 ? _M_impl.allocate(__n) : 0;
- }
- void _M_deallocate(typename _Tp_alloc_type::pointer __p, size_t __n) {
- if (__p) _M_impl.deallocate(__p, __n);
- }
- };
- template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
- typedef typename _Alloc::value_type _Alloc_value_type;
- typedef _Vector_base<_Tp, _Alloc> _Base;
- typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
- public: typedef _Tp value_type;
- typedef typename _Tp_alloc_type::pointer pointer;
- typedef typename _Tp_alloc_type::const_pointer const_pointer;
- typedef typename _Tp_alloc_type::reference reference;
- typedef typename _Tp_alloc_type::const_reference const_reference;
- typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
- typedef __gnu_cxx::__normal_iterator<const_pointer, vector> const_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Alloc allocator_type;
- protected: using _Base::_M_allocate;
- using _Base::_M_deallocate;
- using _Base::_M_impl;
- using _Base::_M_get_Tp_allocator;
- public: vector() : _Base() {
- }
- explicit vector(const allocator_type& __a) : _Base(__a) {
- }
- explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) {
- return iterator(this->_M_impl._M_start);
- }
- const_iterator begin() const {
- return const_iterator(this->_M_impl._M_start);
- }
- iterator end() {
- return iterator(this->_M_impl._M_finish);
- }
- const_iterator end() const {
- return const_iterator(this->_M_impl._M_finish);
- }
- reverse_iterator rbegin() {
- return reverse_iterator(end());
- }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- protected: void _M_range_check(size_type __n) const {
- if (__n >= this->size()) __throw_out_of_range(("vector::_M_range_check"));
- }
- public: const_reference at(size_type __n) const {
- _M_range_check(__n);
- return (*this)[__n];
- }
- reference front() {
- return *begin();
- }
- const_reference front() const {
- return *begin();
- }
- reference back() {
- return *(end() - 1);
- }
- const_reference back() const {
- return *(end() - 1);
- }
- void push_back(const value_type& __x) {
- if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) {
- this->_M_impl.construct(this->_M_impl._M_finish, __x);
- ++this->_M_impl._M_finish;
- }
- else _M_insert_aux(end(), __x);
- }
- iterator erase(iterator __position);
- iterator erase(iterator __first, iterator __last);
- void swap(vector& __x) {
- std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
- std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
- std::swap(this->_M_impl._M_end_of_storage, __x._M_impl._M_end_of_storage);
- std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
- }
- void clear() {
- _M_erase_at_end(this->_M_impl._M_start);
- }
- protected: template<typename _ForwardIterator> pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last) {
- pointer __result = this->_M_allocate(__n);
- try {
- std::__uninitialized_copy_a(__first, __last, __result, _M_get_Tp_allocator());
- return __result;
- }
- catch(...) {
- _M_deallocate(__result, __n);
- throw;
- }
- }
- template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type) {
- this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
- this->_M_impl._M_end_of_storage = this->_M_impl._M_start + static_cast<size_type>(__n);
- _M_fill_initialize(static_cast<size_type>(__n), __value);
- }
- template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) {
- typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory;
- _M_range_initialize(__first, __last, _IterCategory());
- }
- template<typename _InputIterator> void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) {
- for (;
- __first != __last;
- ++__first) push_back(*__first);
- }
- template<typename _ForwardIterator> void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) {
- const size_type __n = std::distance(__first, __last);
- this->_M_impl._M_start = this->_M_allocate(__n);
- }
- template<typename _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, __true_type) {
- _M_fill_insert(__pos, __n, __val);
- }
- template<typename _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) {
- typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory;
- _M_range_insert(__pos, __first, __last, _IterCategory());
- }
- template<typename _InputIterator> void _M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag);
- template<typename _ForwardIterator> void _M_range_insert(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag);
- void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
- void _M_erase_at_end(pointer __pos) {
- std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
- this->_M_impl._M_finish = __pos;
- }
- };
- }
- namespace std __attribute__ ((__visibility__ ("default"))) {
- }
- namespace llvm {
- class BitRecTy;
- class BitsRecTy;
- class IntRecTy;
- class StringRecTy;
- class ListRecTy;
- class CodeRecTy;
- class DagRecTy;
- class RecordRecTy;
- struct Init;
- class UnsetInit;
- class BitInit;
- class BitsInit;
- class IntInit;
- class StringInit;
- class CodeInit;
- class ListInit;
- class UnOpInit;
- class BinOpInit;
- class TernOpInit;
- class DefInit;
- class DagInit;
- class TypedInit;
- class VarInit;
- class FieldInit;
- class VarBitInit;
- class RecordVal;
- struct RecTy {
- virtual ~RecTy() {
- }
- virtual std::string getAsString() const = 0;
- void print(raw_ostream &OS) const {
- OS << getAsString();
- }
- void dump() const;
- virtual bool typeIsConvertibleTo(const RecTy *RHS) const = 0;
- public: virtual Init *convertValue( UnsetInit *UI) {
- return 0;
- }
- virtual Init *convertValue( BitInit *BI) {
- return 0;
- }
- virtual Init *convertValue(StringInit *SI) {
- return 0;
- }
- virtual Init *convertValue( ListInit *LI) {
- return 0;
- }
- virtual Init *convertValue( DagInit *DI) {
- return 0;
- }
- virtual Init *convertValue( TypedInit *TI) {
- return 0;
- }
- virtual Init *convertValue( VarInit *VI) {
- return convertValue((TypedInit*)VI);
- }
- virtual Init *convertValue( FieldInit *FI) {
- return convertValue((TypedInit*)FI);
- }
- public: virtual bool baseClassOf(const BitRecTy *RHS) const {
- return false;
- }
- virtual bool baseClassOf(const BitsRecTy *RHS) const {
- return false;
- }
- virtual bool baseClassOf(const IntRecTy *RHS) const {
- return false;
- }
- virtual bool baseClassOf(const StringRecTy *RHS) const {
- return false;
- }
- virtual bool baseClassOf(const ListRecTy *RHS) const {
- return false;
- }
- virtual bool baseClassOf(const RecordRecTy *RHS) const {
- return false;
- }
- };
- class IntRecTy : public RecTy {
- public: virtual Init *convertValue( UnsetInit *UI) {
- return (Init*)UI;
- }
- virtual Init *convertValue( BitInit *BI);
- virtual Init *convertValue( BitsInit *BI);
- virtual Init *convertValue( IntInit *II) {
- return (Init*)II;
- }
- virtual Init *convertValue(StringInit *SI) {
- return 0;
- }
- virtual Init *convertValue( FieldInit *FI) {
- return RecTy::convertValue(FI);
- }
- std::string getAsString() const {
- return "int";
- }
- bool typeIsConvertibleTo(const RecTy *RHS) const {
- return RHS->baseClassOf(this);
- }
- virtual bool baseClassOf(const BitRecTy *RHS) const {
- return true;
- return false;
- }
- virtual bool baseClassOf(const CodeRecTy *RHS) const {
- return false;
- }
- };
- struct Init {
- virtual ~Init() {
- }
- virtual bool isComplete() const {
- return true;
- }
- void print(raw_ostream &OS) const {
- OS << getAsString();
- }
- virtual std::string getAsString() const = 0;
- void dump() const;
- virtual Init *convertInitializerTo(RecTy *Ty) = 0;
- virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits) {
- return 0;
- }
- virtual Init *convertInitListSlice(const std::vector<unsigned> &Elements) {
- return 0;
- }
- virtual Init *resolveReferences(Record &R, const RecordVal *RV) {
- return this;
- }
- };
- class TypedInit : public Init {
- RecTy *Ty;
- public: explicit TypedInit(RecTy *T) : Ty(T) {
- }
- RecTy *getType() const {
- return Ty;
- }
- virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
- virtual Init *convertInitListSlice(const std::vector<unsigned> &Elements);
- virtual Init *resolveBitReference(Record &R, const RecordVal *RV, unsigned Bit) = 0;
- virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) = 0;
- };
- class IntInit : public TypedInit {
- int64_t Value;
- public: explicit IntInit(int64_t V) : TypedInit(new IntRecTy), Value(V) {
- }
- int64_t getValue() const {
- return Value;
- }
- virtual Init *convertInitializerTo(RecTy *Ty) {
- return Ty->convertValue(this);
- }
- virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, unsigned Elt) {
- ((0 && "Illegal element reference off int") ? static_cast<void> (0) : __assert_fail ("0 && \"Illegal element reference off int\"", "utils/TableGen/Record.h", 648, __PRETTY_FUNCTION__));
- return 0;
- }
- };
- }
- using namespace llvm;
- int InitPtrToInt(const Init* ptr) {
- const IntInit& val = dynamic_cast<const IntInit&>(*ptr);
- }
Add Comment
Please, Sign In to add comment