[Lldb-commits] [lldb] r287409 - Fix some build errors.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 18 15:32:37 PST 2016


Author: zturner
Date: Fri Nov 18 17:32:37 2016
New Revision: 287409

URL: http://llvm.org/viewvc/llvm-project?rev=287409&view=rev
Log:
Fix some build errors.

Modified:
    lldb/trunk/source/Interpreter/CommandHistory.cpp

Modified: lldb/trunk/source/Interpreter/CommandHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandHistory.cpp?rev=287409&r1=287408&r2=287409&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandHistory.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandHistory.cpp Fri Nov 18 17:32:37 2016
@@ -41,7 +41,7 @@ CommandHistory::FindString(llvm::StringR
   if (input_str[1] == g_repeat_char) {
     if (m_history.empty())
       return llvm::None;
-    return m_history.back();
+    return llvm::StringRef(m_history.back());
   }
 
   input_str = input_str.drop_front();
@@ -50,20 +50,17 @@ CommandHistory::FindString(llvm::StringR
   if (input_str.front() == '-') {
     if (input_str.drop_front(2).getAsInteger(0, idx))
       return llvm::None;
-    if (idx > m_history.size())
+    if (idx >= m_history.size())
       return llvm::None;
     idx = m_history.size() - idx;
-    return m_history[idx];
-
   } else {
     if (input_str.drop_front().getAsInteger(0, idx))
       return llvm::None;
-    if (idx > m_history.size())
-      return llvm::None;
     if (idx >= m_history.size())
       return llvm::None;
-    return m_history[idx];
   }
+
+  return llvm::StringRef(m_history[idx]);
 }
 
 llvm::StringRef CommandHistory::GetStringAtIndex(size_t idx) const {




More information about the lldb-commits mailing list