diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-11-14 03:07:47 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-11-14 03:07:47 +0000 |
commit | 4d7f90b06454aa5839b8ebcadf93a6997541714c (patch) | |
tree | 2f38fda50c18123f3b0e5c2b8de586db5f4ab61b | |
parent | 209a39706011a6882fc3c9cbf28db75c96f6bdca (diff) | |
download | bcm5719-llvm-4d7f90b06454aa5839b8ebcadf93a6997541714c.tar.gz bcm5719-llvm-4d7f90b06454aa5839b8ebcadf93a6997541714c.zip |
__cxa_demangle: allow demangling invocation blocks
The block invocation function uses an extension where the prefix is ___Z
as opposed to _Z. This should make the tests pass again.
Disable a negative test which was testing a crasher. The symbol being
demangled is not a valid mangled symbol and will return a nullptr.
Adjust the type info decoding test to be a valid symbol name.
llvm-svn: 286793
-rw-r--r-- | libcxxabi/src/cxa_demangle.cpp | 11 | ||||
-rw-r--r-- | libcxxabi/test/test_demangle.pass.cpp | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp index 8b9dfc957af..4aeed1b8494 100644 --- a/libcxxabi/src/cxa_demangle.cpp +++ b/libcxxabi/src/cxa_demangle.cpp @@ -4980,11 +4980,14 @@ __cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status) { } size_t len = std::strlen(mangled_name); - if (len < 2 || mangled_name[0] != '_' || mangled_name[1] != 'Z') + if (len < 2 || strncmp(mangled_name, "_Z", 2)) { - if (status) - *status = invalid_mangled_name; - return nullptr; + if (len < 4 || strncmp(mangled_name, "___Z", 4)) + { + if (status) + *status = invalid_mangled_name; + return nullptr; + } } size_t internal_size = buf != nullptr ? *n : 0; diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp index bc27181eae3..af16b561eb5 100644 --- a/libcxxabi/test/test_demangle.pass.cpp +++ b/libcxxabi/test/test_demangle.pass.cpp @@ -29478,7 +29478,6 @@ const char* cases[][2] = {"_Z1fPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP1XS13_S12_S11_S10_SZ_SY_SX_SW_SV_SU_ST_SS_SR_SQ_SP_SO_SN_SM_SL_SK_SJ_SI_SH_SG_SF_SE_SD_SC_SB_SA_S9_S8_S7_S6_S5_S4_S3_S2_S1_S0_S_", "f(X****************************************, X****************************************, X***************************************, X**************************************, X*************************************, X************************************, X***********************************, X**********************************, X*********************************, X********************************, X*******************************, X******************************, X*****************************, X****************************, X***************************, X**************************, X*************************, X************************, X***********************, X**********************, X*********************, X********************, X*******************, X******************, X*****************, X****************, X***************, X**************, X*************, X************, X***********, X**********, X*********, X********, X*******, X******, X*****, X****, X***, X**, X*, X)"}, {"_ZZN1J1KEvENK1C1FEv", "J::K()::C::F() const"}, {"_ZZNVK1J1KEvENK1C1FEv", "J::K() const volatile::C::F() const"}, - {"U4_farrVKPi", "int* const volatile restrict _far"}, {"_Z1fM1AKFvvE", "f(void (A::*)() const)"}, {"_ZNR1X1fEv", "X::f() &"}, {"_ZNKO1X1hEv", "X::h() const &&"}, @@ -29591,7 +29590,10 @@ const char* cases[][2] = {"_ZZ4testvEN1g3fooE5Point", "test()::g::foo(Point)"}, {"_ZThn12_NSt9strstreamD0Ev", "non-virtual thunk to std::strstream::~strstream()"}, {"_ZTv0_n12_NSt9strstreamD0Ev", "virtual thunk to std::strstream::~strstream()"}, - {"\x6D", "unsigned long"}, // This use to crash with ASAN + + // NOTE: disable this test since it is a negative test case, you cannot demangle a non-mangled symbol + // {"\x6D", nullptr}, // This use to crash with ASAN + {"_ZTIU4_farrVKPi", "typeinfo for int* const volatile restrict _far"}, }; const unsigned N = sizeof(cases) / sizeof(cases[0]); |