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

Zachary Turner zturner at google.com
Wed Jan 14 19:45:11 PST 2015


Also wasn't it an #ifdef _MSC_VER? I'm curious how you found an error in
that branch if you're running on mac. The code was working for me on
Windows.

Either way I'll double check tomorrow
On Wed, Jan 14, 2015 at 7:40 PM Zachary Turner <zturner at google.com> wrote:

> Err, was that code wrong? I malloc it unconditionally, so it should be
> freed unconditionally (don't have source in front of me, so I'm going from
> memory)
> On Wed, Jan 14, 2015 at 7:36 PM Jim Ingham <jingham at apple.com> wrote:
>
>> 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.SetCStringWithMangledCounterpa
>> rt(demangled_name, m_mangled);
>>                      free (demangled_name);
>>                  }
>> -#endif
>>              }
>>          }
>>          if (!m_demangled)
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150115/287ea4f1/attachment.html>


More information about the lldb-commits mailing list