[Lldb-commits] [lldb] r226088 - Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got

Jim Ingham jingham at apple.com
Wed Jan 14 19:34:31 PST 2015


Author: jingham
Date: Wed Jan 14 21:34:31 2015
New Revision: 226088

URL: http://llvm.org/viewvc/llvm-project?rev=226088&view=rev
Log:
Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got 
moved into the #else branch of the #if/#elif/#endif, so it wasn't getting done in the #if case anymore.

Keep the code to add the demangled name outside of the #if, and then just free the demangled_name
and set it back to NULL in the Windows case.

<rdar://problem/19479499>

Modified:
    lldb/trunk/source/Core/Mangled.cpp

Modified: lldb/trunk/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=226088&r1=226087&r2=226088&view=diff
==============================================================================
--- lldb/trunk/source/Core/Mangled.cpp (original)
+++ lldb/trunk/source/Core/Mangled.cpp Wed Jan 14 21:34:31 2015
@@ -5240,18 +5240,20 @@ Mangled::GetDemangledName () const
                                                           UNDNAME_NO_MEMBER_TYPE |         // Strip virtual, static, etc specifiers
                                                           UNDNAME_NO_MS_KEYWORDS           // Strip all MS extension keywords
                                                       );
-                if (result > 0)
-                    m_demangled.SetCStringWithMangledCounterpart(demangled_name, m_mangled);
-                free(demangled_name);
+                if (result == 0)
+                {
+                    free (demangled_name);
+                    demangled_name = nullptr;
+                }
 #else
                 char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
+#endif
 
                 if (demangled_name)
                 {
                     m_demangled.SetCStringWithMangledCounterpart(demangled_name, m_mangled);
                     free (demangled_name);
                 }
-#endif
             }
         }
         if (!m_demangled)





More information about the lldb-commits mailing list