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 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4591 String move_full() {return std::move(first) + std::move(second);} | 4591 String move_full() {return std::move(first) + std::move(second);} |
4592 }; | 4592 }; |
4593 | 4593 |
4594 } // unnamed namespace | 4594 } // unnamed namespace |
4595 | 4595 |
4596 __attribute__ ((__visibility__("default"))) | 4596 __attribute__ ((__visibility__("default"))) |
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 // @LOCALMOD-START | |
4602 // The demangler is *huge* and only used in default_terminate_handler | |
4603 // with a fallback to printing mangled names instead. pexe size | |
4604 // matters a lot, so PNaCl only prints out mangled names when | |
4605 // exceptions are uncaught. | |
4606 #ifdef __pnacl__ | |
4607 *status = 1; | |
jvoung (off chromium)
2013/12/04 01:52:00
The API says that status may be a null pointer (in
JF
2013/12/04 02:10:25
I fixed this and also moved the code down so it st
| |
4608 return 0; | |
4609 #else | |
4610 // @LOCALMOD-END | |
4601 if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) | 4611 if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) |
4602 { | 4612 { |
4603 if (status) | 4613 if (status) |
4604 *status = invalid_args; | 4614 *status = invalid_args; |
4605 return nullptr; | 4615 return nullptr; |
4606 } | 4616 } |
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 { |
(...skipping 63 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 |