diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-05-02 15:38:11 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-05-02 15:38:11 +0000 |
commit | ba2e8aeda5e1789abb5d4aabcfe61bdf380aa638 (patch) | |
tree | 0c47506096d5ae60d2629588644be35654eb2583 /libcxxabi/src | |
parent | b170ed0bbe253088ff83dcb274e60d9205c5c8d9 (diff) | |
download | bcm5719-llvm-ba2e8aeda5e1789abb5d4aabcfe61bdf380aa638.tar.gz bcm5719-llvm-ba2e8aeda5e1789abb5d4aabcfe61bdf380aa638.zip |
Fix bug in cxa_demangle involving template substitution.
llvm-svn: 155994
Diffstat (limited to 'libcxxabi/src')
-rw-r--r-- | libcxxabi/src/cxa_demangle.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp index 86c190f3561..6a8029f4f31 100644 --- a/libcxxabi/src/cxa_demangle.cpp +++ b/libcxxabi/src/cxa_demangle.cpp @@ -134,9 +134,10 @@ void display(__node* x, int indent = 0) { for (int i = 0; i < 2*indent; ++i) printf(" "); - std::string buf(x->size(), '\0'); - x->get_demangled_name(&buf.front()); - printf("%s %s, %p\n", typeid(*x).name(), buf.c_str(), x); + char* buf = (char*)malloc(x->size()); + x->get_demangled_name(buf); + printf("%s %s, %p\n", typeid(*x).name(), buf, x); + free(buf); display(x->__left_, indent+1); display(x->__right_, indent+1); } @@ -6524,6 +6525,7 @@ __demangle_tree::__parse_bare_function_type(const char* first, const char* last) { if (first != last) { + bool prev_tag_templates = __tag_templates_; __tag_templates_ = false; const char* t = __parse_type(first, last); if (t != first && __make<__list>(__root_)) @@ -6554,7 +6556,7 @@ __demangle_tree::__parse_bare_function_type(const char* first, const char* last) } } } - __tag_templates_ = true; + __tag_templates_ = prev_tag_templates; } return first; } @@ -10696,6 +10698,7 @@ __demangle_tree::__parse_encoding(const char* first, const char* last) !name->is_ctor_dtor_conv(); __node* ret = NULL; const char* t2; + bool prev_tag_templates = __tag_templates_; __tag_templates_ = false; if (has_return) { @@ -10728,7 +10731,7 @@ __demangle_tree::__parse_encoding(const char* first, const char* last) } } } - __tag_templates_ = true; + __tag_templates_ = prev_tag_templates; } else first = t; @@ -10864,7 +10867,7 @@ __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status) *status = __libcxxabi::invalid_args; return NULL; } - const size_t bs = 64 * 1024; + const size_t bs = 4 * 1024; __attribute((aligned(16))) char static_buf[bs]; buf = __libcxxabi::__demangle(__libcxxabi::__demangle(mangled_name, |