| OLD | NEW |
| 1 //===-------------------------- cxa_demangle.cpp --------------------------===// | 1 //===-------------------------- cxa_demangle.cpp --------------------------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is dual licensed under the MIT and the University of Illinois Open | 5 // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 // Source Licenses. See LICENSE.TXT for details. | 6 // Source Licenses. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 #define _LIBCPP_EXTERN_TEMPLATE(...) | 10 #define _LIBCPP_EXTERN_TEMPLATE(...) |
| (...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4597 extern "C" | 4597 extern "C" |
| 4598 char* | 4598 char* |
| 4599 __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status) | 4599 __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status) |
| 4600 { | 4600 { |
| 4601 if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) | 4601 if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) |
| 4602 { | 4602 { |
| 4603 if (status) | 4603 if (status) |
| 4604 *status = invalid_args; | 4604 *status = invalid_args; |
| 4605 return nullptr; | 4605 return nullptr; |
| 4606 } | 4606 } |
| 4607 // @LOCALMOD-START The demangler is *huge* and only used in |
| 4608 // default_terminate_handler with a fallback to printing mangled |
| 4609 // names instead. pexe size matters a lot, so PNaCl only prints out |
| 4610 // mangled names when exceptions are uncaught. |
| 4611 #ifdef __pnacl__ |
| 4612 if (status) |
| 4613 *status = memory_alloc_failure; |
| 4614 return nullptr; |
| 4615 #else |
| 4616 // @LOCALMOD-END |
| 4607 size_t internal_size = buf != nullptr ? *n : 0; | 4617 size_t internal_size = buf != nullptr ? *n : 0; |
| 4608 arena<bs> a; | 4618 arena<bs> a; |
| 4609 struct Db | 4619 struct Db |
| 4610 { | 4620 { |
| 4611 typedef String String; | 4621 typedef String String; |
| 4612 typedef Vector<string_pair> sub_type; | 4622 typedef Vector<string_pair> sub_type; |
| 4613 typedef Vector<sub_type> template_param_type; | 4623 typedef Vector<sub_type> template_param_type; |
| 4614 Vector<string_pair> names; | 4624 Vector<string_pair> names; |
| 4615 Vector<sub_type> subs; | 4625 Vector<sub_type> subs; |
| 4616 Vector<template_param_type> template_param; | 4626 Vector<template_param_type> template_param; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4674 db.names.back().first += db.names.back().second; | 4684 db.names.back().first += db.names.back().second; |
| 4675 std::memcpy(buf, db.names.back().first.data(), sz-1); | 4685 std::memcpy(buf, db.names.back().first.data(), sz-1); |
| 4676 buf[sz-1] = char(0); | 4686 buf[sz-1] = char(0); |
| 4677 } | 4687 } |
| 4678 } | 4688 } |
| 4679 else | 4689 else |
| 4680 buf = nullptr; | 4690 buf = nullptr; |
| 4681 if (status) | 4691 if (status) |
| 4682 *status = internal_status; | 4692 *status = internal_status; |
| 4683 return buf; | 4693 return buf; |
| 4694 // @LOCALMOD-START |
| 4695 #endif // __pnacl__ |
| 4696 // @LOCALMOD-END |
| 4684 } | 4697 } |
| 4685 | 4698 |
| 4686 } // __cxxabiv1 | 4699 } // __cxxabiv1 |
| OLD | NEW |