Author: teemperor
Date: Mon Sep 23 02:51:36 2019
New Revision: 372568

URL: http://llvm.org/viewvc/llvm-project?rev=372568&view=rev
Log:
[lldb][NFC] Make cursor char position unsigned in CompletionRequest

This was only an 'int' because to fit into the old API which is
gone by now.

Modified:
    lldb/trunk/include/lldb/Utility/CompletionRequest.h
    lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/Utility/CompletionRequest.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/CompletionRequest.h?rev=372568&r1=372567&r2=372568&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/CompletionRequest.h (original)
+++ lldb/trunk/include/lldb/Utility/CompletionRequest.h Mon Sep 23 02:51:36 2019
@@ -129,8 +129,8 @@ public:
   void SetCursorIndex(size_t i) { m_cursor_index = i; }
   size_t GetCursorIndex() const { return m_cursor_index; }
 
-  void SetCursorCharPosition(int pos) { m_cursor_char_position = pos; }
-  int GetCursorCharPosition() const { return m_cursor_char_position; }
+  void SetCursorCharPosition(size_t pos) { m_cursor_char_position = pos; }
+  size_t GetCursorCharPosition() const { return m_cursor_char_position; }
 
   /// Adds a possible completion string. If the completion was already
   /// suggested before, it will not be added to the list of results. A copy of
@@ -210,7 +210,7 @@ private:
   /// The index of the argument in which the completion cursor is.
   size_t m_cursor_index;
   /// The cursor position in the argument indexed by m_cursor_index.
-  int m_cursor_char_position;
+  size_t m_cursor_char_position;
 
   /// The result this request is supposed to fill out.
   /// We keep this object private to ensure that no backend can in any way

Modified: lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CompletionRequestTest.cpp?rev=372568&r1=372567&r2=372568&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/CompletionRequestTest.cpp (original)
+++ lldb/trunk/unittests/Utility/CompletionRequestTest.cpp Mon Sep 23 02:51:36 
2019
@@ -15,7 +15,7 @@ TEST(CompletionRequest, Constructor) {
   std::string command = "a bad c";
   const unsigned cursor_pos = 3;
   const size_t arg_index = 1;
-  const int arg_cursor_pos = 1;
+  const size_t arg_cursor_pos = 1;
   StringList matches;
   CompletionResult result;
 
@@ -43,7 +43,7 @@ TEST(CompletionRequest, FakeLastArg) {
   EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str());
   EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
   EXPECT_EQ(request.GetCursorIndex(), 3U);
-  EXPECT_EQ(request.GetCursorCharPosition(), 0);
+  EXPECT_EQ(request.GetCursorCharPosition(), 0U);
 
   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 4U);
   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(3), "");
@@ -90,7 +90,7 @@ TEST(CompletionRequest, ShiftArguments)
   std::string command = "a bad c";
   const unsigned cursor_pos = 3;
   const size_t arg_index = 1;
-  const int arg_cursor_pos = 1;
+  const size_t arg_cursor_pos = 1;
   StringList matches;
   CompletionResult result;
 


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to