[libc++abi] Refactor exception type demangling into a separate function

As a fly-by fix, also let `__cxa_demangle` allocate its buffer alone,
since we are not allowed to pass a non-malloc'd buffer to it.

Differential Revision: https://reviews.llvm.org/D125268

GitOrigin-RevId: 6089fd6c0b1cca4fd16583b25954c132a9b58ebd
1 file changed