summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-02-10 16:10:42 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-02-10 16:10:42 +0000
commit78c135942da5cff2829cbb422549218294b15a5f (patch)
treee5ee72da66bdac374ab5c21b7f736c62e14e72fc /lldb/source/Host
parentbcde0c49cb09dcff7c7da5ebca7e03983ffd5399 (diff)
downloadbcm5719-llvm-78c135942da5cff2829cbb422549218294b15a5f.tar.gz
bcm5719-llvm-78c135942da5cff2829cbb422549218294b15a5f.zip
Host: unconstify editline paramters
Although the interface to el_push should be a constant parameter (as it is on Darwin), certain Linux distributions currently ship a header which does not provide proper const correctness. This causes compilation failures on Linux. Strip the constness on the parameter, which whilst incorrect, is mostly harmless. The parameter will not be changed by the interface and so it is acceptable to do this. When distributions have updated to a more correct declaration, it would be nice to revert this change. Addresses PR18784. llvm-svn: 201092
Diffstat (limited to 'lldb/source/Host')
-rw-r--r--lldb/source/Host/common/Editline.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index d0170620f59..f2b7a1fc111 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -264,7 +264,8 @@ Editline::Push (const char *bytes, size_t len)
{
// Must NULL terminate the string for el_push() so we stick it
// into a std::string first
- ::el_push(m_editline, std::string (bytes, len).c_str());
+ ::el_push(m_editline,
+ const_cast<char*>(std::string (bytes, len).c_str()));
return len;
}
return 0;
@@ -340,7 +341,8 @@ Editline::GetLines(const std::string &end_line, StringList &lines)
// we were editing previous lines, then populate the line
// with the appropriate contents
if (line_idx+1 < lines.GetSize() && !lines[line_idx+1].empty())
- ::el_push (m_editline, lines[line_idx+1].c_str());
+ ::el_push (m_editline,
+ const_cast<char*>(lines[line_idx+1].c_str()));
}
else if (line_status == LineStatus::Error)
{
@@ -356,7 +358,8 @@ Editline::GetLines(const std::string &end_line, StringList &lines)
//::fprintf (out_file, "\033[1A\033[%uD\033[2K", (uint32_t)(m_lines_prompt.size() + lines[line_idx].size())); // Make cursor go up a line and clear that line
::fprintf (out_file, "\033[1A\033[1000D\033[2K");
if (!lines[line_idx-1].empty())
- ::el_push (m_editline, lines[line_idx-1].c_str());
+ ::el_push (m_editline,
+ const_cast<char*>(lines[line_idx-1].c_str()));
--m_lines_curr_line;
}
break;
@@ -366,7 +369,8 @@ Editline::GetLines(const std::string &end_line, StringList &lines)
//::fprintf (out_file, "\033[1B\033[%uD\033[2K", (uint32_t)(m_lines_prompt.size() + lines[line_idx].size()));
::fprintf (out_file, "\033[1B\033[1000D\033[2K");
if (line_idx+1 < lines.GetSize() && !lines[line_idx+1].empty())
- ::el_push (m_editline, lines[line_idx+1].c_str());
+ ::el_push (m_editline,
+ const_cast<char*>(lines[line_idx+1].c_str()));
break;
}
}
OpenPOWER on IntegriCloud