summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandHistory.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-11-18 23:32:37 +0000
committerZachary Turner <zturner@google.com>2016-11-18 23:32:37 +0000
commiteb4a0cb16b74f6b973c11bd0b371f387853e48fc (patch)
tree30d898f360abc38b1316073019596776ef3d96d2 /lldb/source/Interpreter/CommandHistory.cpp
parentb653c4957d21bc1e59a435c627dc2e0351a37c2b (diff)
downloadbcm5719-llvm-eb4a0cb16b74f6b973c11bd0b371f387853e48fc.tar.gz
bcm5719-llvm-eb4a0cb16b74f6b973c11bd0b371f387853e48fc.zip
Fix some build errors.
llvm-svn: 287409
Diffstat (limited to 'lldb/source/Interpreter/CommandHistory.cpp')
-rw-r--r--lldb/source/Interpreter/CommandHistory.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lldb/source/Interpreter/CommandHistory.cpp b/lldb/source/Interpreter/CommandHistory.cpp
index fda7a1a3e58..c16f71374c7 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 {
OpenPOWER on IntegriCloud