[Lldb-commits] [lldb] r286726 - Make ValueObjectMemory::Create accept StringRefs.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Sat Nov 12 10:17:37 PST 2016


Author: zturner
Date: Sat Nov 12 12:17:36 2016
New Revision: 286726

URL: http://llvm.org/viewvc/llvm-project?rev=286726&view=rev
Log:
Make ValueObjectMemory::Create accept StringRefs.

Modified:
    lldb/trunk/include/lldb/Core/ValueObjectMemory.h
    lldb/trunk/source/Breakpoint/Watchpoint.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Core/ValueObjectMemory.cpp
    lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObjectMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectMemory.h?rev=286726&r1=286725&r2=286726&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectMemory.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectMemory.h Sat Nov 12 12:17:36 2016
@@ -28,11 +28,13 @@ public:
   ~ValueObjectMemory() override;
 
   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
-                                    const char *name, const Address &address,
+                                    llvm::StringRef name,
+                                    const Address &address,
                                     lldb::TypeSP &type_sp);
 
   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
-                                    const char *name, const Address &address,
+                                    llvm::StringRef name,
+                                    const Address &address,
                                     const CompilerType &ast_type);
 
   uint64_t GetByteSize() override;
@@ -59,10 +61,10 @@ protected:
   CompilerType m_compiler_type;
 
 private:
-  ValueObjectMemory(ExecutionContextScope *exe_scope, const char *name,
+  ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
                     const Address &address, lldb::TypeSP &type_sp);
 
-  ValueObjectMemory(ExecutionContextScope *exe_scope, const char *name,
+  ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
                     const Address &address, const CompilerType &ast_type);
   //------------------------------------------------------------------
   // For ValueObject only

Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=286726&r1=286725&r2=286726&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Sat Nov 12 12:17:36 2016
@@ -109,9 +109,9 @@ bool Watchpoint::CaptureWatchedValue(con
     // we can go grab the value raw and print it as unsigned.
     return false;
   }
-  m_new_value_sp =
-      ValueObjectMemory::Create(exe_ctx.GetBestExecutionContextScope(),
-                                watch_name.AsCString(), watch_address, m_type);
+  m_new_value_sp = ValueObjectMemory::Create(
+      exe_ctx.GetBestExecutionContextScope(), watch_name.GetStringRef(),
+      watch_address, m_type);
   m_new_value_sp = m_new_value_sp->CreateConstantValue(watch_name);
   return (m_new_value_sp && m_new_value_sp->GetError().Success());
 }

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=286726&r1=286725&r2=286726&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Sat Nov 12 12:17:36 2016
@@ -810,7 +810,7 @@ protected:
         StreamString name_strm;
         name_strm.Printf("0x%" PRIx64, item_addr);
         ValueObjectSP valobj_sp(ValueObjectMemory::Create(
-            exe_scope, name_strm.GetString().c_str(), address, clang_ast_type));
+            exe_scope, name_strm.GetString(), address, clang_ast_type));
         if (valobj_sp) {
           Format format = m_format_options.GetFormat();
           if (format != eFormatDefault)

Modified: lldb/trunk/source/Core/ValueObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectMemory.cpp?rev=286726&r1=286725&r2=286726&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectMemory.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectMemory.cpp Sat Nov 12 12:17:36 2016
@@ -33,21 +33,22 @@ using namespace lldb;
 using namespace lldb_private;
 
 ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
-                                        const char *name,
+                                        llvm::StringRef name,
                                         const Address &address,
                                         lldb::TypeSP &type_sp) {
   return (new ValueObjectMemory(exe_scope, name, address, type_sp))->GetSP();
 }
 
 ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
-                                        const char *name,
+                                        llvm::StringRef name,
                                         const Address &address,
                                         const CompilerType &ast_type) {
   return (new ValueObjectMemory(exe_scope, name, address, ast_type))->GetSP();
 }
 
 ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
-                                     const char *name, const Address &address,
+                                     llvm::StringRef name,
+                                     const Address &address,
                                      lldb::TypeSP &type_sp)
     : ValueObject(exe_scope), m_address(address), m_type_sp(type_sp),
       m_compiler_type() {
@@ -73,7 +74,8 @@ ValueObjectMemory::ValueObjectMemory(Exe
 }
 
 ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
-                                     const char *name, const Address &address,
+                                     llvm::StringRef name,
+                                     const Address &address,
                                      const CompilerType &ast_type)
     : ValueObject(exe_scope), m_address(address), m_type_sp(),
       m_compiler_type(ast_type) {

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=286726&r1=286725&r2=286726&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Sat Nov 12 12:17:36 2016
@@ -1595,7 +1595,7 @@ lldb::ValueObjectSP DoGuessValueAt(Stack
         name_str.append("()");
         Address return_value_address(return_value.GetAsUInt64());
         ValueObjectSP return_value_sp = ValueObjectMemory::Create(
-            &frame, name_str.c_str(), return_value_address, return_type);
+            &frame, name_str, return_value_address, return_type);
         return GetValueForDereferincingOffset(frame, return_value_sp, offset);
       }
       }




More information about the lldb-commits mailing list