Fix bug in cxa_demangle involving template substitution.

llvm-svn: 155994
This commit is contained in:
Howard Hinnant 2012-05-02 15:38:11 +00:00
parent b170ed0bbe
commit ba2e8aeda5
2 changed files with 10 additions and 6 deletions

View File

@ -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,

View File

@ -29564,6 +29564,7 @@ const char* cases[][2] =
{"_ZN3WTF15deleteAllValuesIPN7WebCore5XPath4Step8NodeTestEKNS_9HashTableIS5_S5_NS_17IdentityExtractorENS_7PtrHashIS5_EENS_10HashTraitsIS5_EESB_EEEEvRT0_", "void WTF::deleteAllValues<WebCore::XPath::Step::NodeTest*, WTF::HashTable<WebCore::XPath::Step::NodeTest*, WebCore::XPath::Step::NodeTest*, WTF::IdentityExtractor, WTF::PtrHash<WebCore::XPath::Step::NodeTest*>, WTF::HashTraits<WebCore::XPath::Step::NodeTest*>, WTF::HashTraits<WebCore::XPath::Step::NodeTest*> > const>(WTF::HashTable<WebCore::XPath::Step::NodeTest*, WebCore::XPath::Step::NodeTest*, WTF::IdentityExtractor, WTF::PtrHash<WebCore::XPath::Step::NodeTest*>, WTF::HashTraits<WebCore::XPath::Step::NodeTest*>, WTF::HashTraits<WebCore::XPath::Step::NodeTest*> > const&)"},
{"_Z13JVTLib_103270ILi1EEvPsDv2_xS1_", "void JVTLib_103270<1>(short*, long long vector[2], long long vector[2])"},
{"_ZN8platform20split_string_convertIcPFiRKSsEiSaIiESt6vectorEEjPKT_S9_S7_T0_RT3_IT1_T2_E", "unsigned int platform::split_string_convert<char, int (*)(std::string const&), int, std::allocator<int>, std::vector>(char const*, char const*, char, int (*)(std::string const&), std::vector<int, std::allocator<int> >&)"},
{"_ZN2MF12_GLOBAL__N_114WeakCallHelperINS0_15DecodeQueueImplEEEvRKN5boost8functionIFvvEEERKNS3_8weak_ptrIT_EE", "void MF::(anonymous namespace)::WeakCallHelper<MF::(anonymous namespace)::DecodeQueueImpl>(boost::function<void ()> const&, boost::weak_ptr<MF::(anonymous namespace)::DecodeQueueImpl> const&)"},
};
const unsigned N = sizeof(cases) / sizeof(cases[0]);