Author: hhinnant
Date: Wed May  2 10:38:11 2012
New Revision: 155994

URL: http://llvm.org/viewvc/llvm-project?rev=155994&view=rev
Log:
Fix bug in cxa_demangle involving template substitution.

Modified:
    libcxxabi/trunk/src/cxa_demangle.cpp
    libcxxabi/trunk/test/test_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=155994&r1=155993&r2=155994&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed May  2 10:38:11 2012
@@ -134,9 +134,10 @@
     {
         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 @@
 {
     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 @@
                 }
             }
         }
-        __tag_templates_ = true;
+        __tag_templates_ = prev_tag_templates;
     }
     return first;
 }
@@ -10696,6 +10698,7 @@
                              !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 @@
                     }
                 }
             }
-            __tag_templates_ = true;
+            __tag_templates_ = prev_tag_templates;
         }
         else
             first = t;
@@ -10864,7 +10867,7 @@
             *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,

Modified: libcxxabi/trunk/test/test_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.cpp?rev=155994&r1=155993&r2=155994&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_demangle.cpp (original)
+++ libcxxabi/trunk/test/test_demangle.cpp Wed May  2 10:38:11 2012
@@ -29564,6 +29564,7 @@
     
{"_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]);


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to