__cxa_demangle: ensure that we have a mangled symbol

Ensure that we have a mangled symbol before attempting to demangle it.  We would
previously treat any input as a mangled symbol rather than checking that the
symbol has the initial C++ Itanium v3 mangling prefix of `_Z`.  This changes the
behaviour from the previous case which would undecorate `f` to `float` rather
than nullptr as it should.

Unfortunately, we do not have any negative testing for the demangler.

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@286788 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed