forked from OSchip/llvm-project
parent
06f6fe875a
commit
6cf6f89005
|
@ -95,6 +95,17 @@ Watchpoint::SetWatchSpec (const std::string &str)
|
|||
return;
|
||||
}
|
||||
|
||||
// Strip at most one character from the end of the string.
|
||||
static inline std::string
|
||||
RStripOnce(const std::string &str, const char c)
|
||||
{
|
||||
std::string res = str;
|
||||
size_t len = res.length();
|
||||
if (len && res.at(len - 1) == '\n')
|
||||
res.resize(len - 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string
|
||||
Watchpoint::GetOldSnapshot() const
|
||||
{
|
||||
|
@ -104,11 +115,7 @@ Watchpoint::GetOldSnapshot() const
|
|||
void
|
||||
Watchpoint::SetOldSnapshot (const std::string &str)
|
||||
{
|
||||
size_t len = str.length();
|
||||
m_snapshot_old_str = str;
|
||||
if (len && str.at(len - 1) == '\n')
|
||||
m_snapshot_old_str.resize(len - 1);
|
||||
return;
|
||||
m_snapshot_old_str = RStripOnce(str, '\n');
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -121,11 +128,7 @@ void
|
|||
Watchpoint::SetNewSnapshot (const std::string &str)
|
||||
{
|
||||
m_snapshot_old_str = m_snapshot_new_str;
|
||||
size_t len = str.length();
|
||||
m_snapshot_new_str = str;
|
||||
if (len && str.at(len - 1) == '\n')
|
||||
m_snapshot_new_str.resize(len - 1);
|
||||
return;
|
||||
m_snapshot_new_str = RStripOnce(str, '\n');
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
|
Loading…
Reference in New Issue