[demangler] Fix a exponential string copying bug

The problem was that if base_name() was called from a context without
an actual base name, it could gulp up the entire string, which can
result in recursive duplications. The fix is to be more strict as to
what qualifies as a base name.

Differential revision: https://reviews.llvm.org/D33637

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@304113 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed