[PATCH] D49309: No longer pass a StringRef to the Python API

Raphael Isemann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 13 11:18:55 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337030: No longer pass a StringRef to the Python API (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49309?vs=155434&id=155440#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49309

Files:
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
 bool ScriptInterpreterPython::ExecuteOneLine(
     llvm::StringRef command, CommandReturnObject *result,
     const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
     return false;
 
@@ -855,7 +857,7 @@
           if (PyCallable_Check(m_run_one_line_function.get())) {
             PythonObject pargs(
                 PyRefType::Owned,
-                Py_BuildValue("(Os)", session_dict.get(), command));
+                Py_BuildValue("(Os)", session_dict.get(), command_str.c_str()));
             if (pargs.IsValid()) {
               PythonObject return_value(
                   PyRefType::Owned,
@@ -895,7 +897,6 @@
 
     // The one-liner failed.  Append the error message.
     if (result) {
-      std::string command_str = command.str();
       result->AppendErrorWithFormat(
           "python failed attempting to evaluate '%s'\n", command_str.c_str());
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49309.155440.patch
Type: text/x-patch
Size: 1274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180713/2eece07b/attachment.bin>


More information about the llvm-commits mailing list