diff options
author | Enrico Granata <egranata@apple.com> | 2014-08-23 00:11:38 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-08-23 00:11:38 +0000 |
commit | 3ee335a762a667975fec726344b4129876e05331 (patch) | |
tree | 9481ce7a4267cb56c77b35d4b9903894fd7c9a54 | |
parent | 300bdb35d45d35758f9a09d46acc0b33d4a5785b (diff) | |
download | bcm5719-llvm-3ee335a762a667975fec726344b4129876e05331.tar.gz bcm5719-llvm-3ee335a762a667975fec726344b4129876e05331.zip |
Fix a couple of potential issues in the lexer where we were ignoring the putback data
llvm-svn: 216304
-rw-r--r-- | lldb/source/Utility/StringLexer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Utility/StringLexer.cpp b/lldb/source/Utility/StringLexer.cpp index 69880d21e96..4889ed7451a 100644 --- a/lldb/source/Utility/StringLexer.cpp +++ b/lldb/source/Utility/StringLexer.cpp @@ -55,7 +55,9 @@ StringLexer::Next () bool StringLexer::HasAtLeast (Size s) { - return m_data.size()-m_position >= s; + auto in_m_data = m_data.size()-m_position; + auto in_putback = m_putback_data.size(); + return (in_m_data + in_putback >= s); } @@ -68,6 +70,10 @@ StringLexer::PutBack (Character c) bool StringLexer::HasAny (Character c) { + const auto begin(m_putback_data.begin()); + const auto end(m_putback_data.end()); + if (std::find(begin, end, c) != end) + return true; return m_data.find(c, m_position) != std::string::npos; } |