From eb4a0cb16b74f6b973c11bd0b371f387853e48fc Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 18 Nov 2016 23:32:37 +0000 Subject: [PATCH] Fix some build errors. llvm-svn: 287409 --- lldb/source/Interpreter/CommandHistory.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lldb/source/Interpreter/CommandHistory.cpp b/lldb/source/Interpreter/CommandHistory.cpp index fda7a1a..c16f713 100644 --- a/lldb/source/Interpreter/CommandHistory.cpp +++ b/lldb/source/Interpreter/CommandHistory.cpp @@ -41,7 +41,7 @@ CommandHistory::FindString(llvm::StringRef input_str) const { 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::StringRef input_str) const { 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 { -- 2.7.4