[Lldb-commits] [lldb] r335102 - BreakpointIDList: Use llvm::ArrayRef instead of pointer+length pair

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 20 01:12:50 PDT 2018


Author: labath
Date: Wed Jun 20 01:12:50 2018
New Revision: 335102

URL: http://llvm.org/viewvc/llvm-project?rev=335102&view=rev
Log:
BreakpointIDList: Use llvm::ArrayRef instead of pointer+length pair

NFC

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h
    lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h?rev=335102&r1=335101&r2=335102&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h Wed Jun 20 01:12:50 2018
@@ -55,7 +55,7 @@ public:
 
   bool FindBreakpointID(const char *bp_id, size_t *position) const;
 
-  void InsertStringArray(const char **string_array, size_t array_size,
+  void InsertStringArray(llvm::ArrayRef<const char *> string_array,
                          CommandReturnObject &result);
 
   // Returns a pair consisting of the beginning and end of a breakpoint

Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=335102&r1=335101&r2=335102&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Wed Jun 20 01:12:50 2018
@@ -89,14 +89,13 @@ bool BreakpointIDList::FindBreakpointID(
   return FindBreakpointID(*bp_id, position);
 }
 
-void BreakpointIDList::InsertStringArray(const char **string_array,
-                                         size_t array_size,
-                                         CommandReturnObject &result) {
-  if (string_array == nullptr)
+void BreakpointIDList::InsertStringArray(
+    llvm::ArrayRef<const char *> string_array, CommandReturnObject &result) {
+  if(string_array.empty())
     return;
 
-  for (uint32_t i = 0; i < array_size; ++i) {
-    auto bp_id = BreakpointID::ParseCanonicalReference(string_array[i]);
+  for (const char *str : string_array) {
+    auto bp_id = BreakpointID::ParseCanonicalReference(str);
     if (bp_id.hasValue())
       m_breakpoint_ids.push_back(*bp_id);
   }

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=335102&r1=335101&r2=335102&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Wed Jun 20 01:12:50 2018
@@ -2573,8 +2573,7 @@ void CommandObjectMultiwordBreakpoint::V
   // NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual
   // BreakpointIDList:
 
-  valid_ids->InsertStringArray(temp_args.GetConstArgumentVector(),
-                               temp_args.GetArgumentCount(), result);
+  valid_ids->InsertStringArray(temp_args.GetArgumentArrayRef(), result);
 
   // At this point,  all of the breakpoint ids that the user passed in have
   // been converted to breakpoint IDs and put into valid_ids.




More information about the lldb-commits mailing list