[Lldb-commits] [lldb] r248597 - [lldb-mi] Fix assignment operator in CMIUtilString

Dawn Perchik via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 25 11:08:45 PDT 2015


Author: dperchik
Date: Fri Sep 25 13:08:45 2015
New Revision: 248597

URL: http://llvm.org/viewvc/llvm-project?rev=248597&view=rev
Log:
[lldb-mi] Fix assignment operator in CMIUtilString

Fix assignment operator in CMIUtilString to not crash the debugger if it
is passed a NULL pointer, which can happen in code like the following:

    SBValue val;
    CMIUtilString s;
    //...
    s = val.GetSummary();

Patch from evgeny.leviant at gmail.com
Reviewed by: clayborg, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13094

Modified:
    lldb/trunk/tools/lldb-mi/MIUtilString.cpp

Modified: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=248597&r1=248596&r2=248597&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp Fri Sep 25 13:08:45 2015
@@ -63,14 +63,7 @@ CMIUtilString::CMIUtilString(const std::
 //--
 CMIUtilString &CMIUtilString::operator=(const char *vpRhs)
 {
-    if (*this == vpRhs)
-        return *this;
-
-    if (vpRhs != nullptr)
-    {
-        assign(vpRhs);
-    }
-
+    assign(vpRhs);
     return *this;
 }
 




More information about the lldb-commits mailing list