diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-09-15 12:00:08 +0000 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-09-15 12:00:08 +0000 |
commit | 7dd8c12d847ba578b8783dc883611a7df13c5d68 (patch) | |
tree | 9229409d2747b57b8fbe98eaf5eca44c6891d7f4 /lldb/tools/lldb-mi/MICmdArgSet.cpp | |
parent | 9c8453fb4b44435d25dbc2d35293a600fc107fb1 (diff) | |
download | bcm5719-llvm-7dd8c12d847ba578b8783dc883611a7df13c5d68.tar.gz bcm5719-llvm-7dd8c12d847ba578b8783dc883611a7df13c5d68.zip |
[lldb-mi] Clean up CMICmdArgSet usage.
Summary:
CMICmdArgSet stores a vector of non-const pointers to the arguments
that it is validating. It owns them and is responsible for deleting
them.
We don't need to pass a const reference to the argument to
CMICmdArgSet::Add and then take the address and const_cast it
when we can just pass the argument pointer in directly.
This lets us remove some noise at every call site for CMICmdArgSet::Add
and then clean up a couple of bits inside CMICmdArgSet to remove
const_casts.
Reviewers: abidh, ki.stfu, domipheus
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12878
llvm-svn: 247677
Diffstat (limited to 'lldb/tools/lldb-mi/MICmdArgSet.cpp')
-rw-r--r-- | lldb/tools/lldb-mi/MICmdArgSet.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lldb/tools/lldb-mi/MICmdArgSet.cpp b/lldb/tools/lldb-mi/MICmdArgSet.cpp index 7439e11dd71..9fe5b2d97dc 100644 --- a/lldb/tools/lldb-mi/MICmdArgSet.cpp +++ b/lldb/tools/lldb-mi/MICmdArgSet.cpp @@ -94,10 +94,9 @@ CMICmdArgSet::IsArgsPresentButNotHandledByCmd() const // Throws: None. //-- void -CMICmdArgSet::Add(const CMICmdArgValBase &vArg) +CMICmdArgSet::Add(CMICmdArgValBase *vArg) { - CMICmdArgValBase *pArg = const_cast<CMICmdArgValBase *>(&vArg); - m_setCmdArgs.push_back(pArg); + m_setCmdArgs.push_back(vArg); } //++ ------------------------------------------------------------------------------------ @@ -169,25 +168,25 @@ CMICmdArgSet::Validate(const CMIUtilString &vStrMiCmd, CMICmdArgContext &vwCmdAr SetCmdArgs_t::const_iterator it = m_setCmdArgs.begin(); while (it != m_setCmdArgs.end()) { - const CMICmdArgValBase *pArg(*it); + CMICmdArgValBase *pArg = *it; - if (!const_cast<CMICmdArgValBase *>(pArg)->Validate(vwCmdArgsText)) + if (!pArg->Validate(vwCmdArgsText)) { if (pArg->GetFound()) { if (pArg->GetIsMissingOptions()) - m_setCmdArgsMissingInfo.push_back(const_cast<CMICmdArgValBase *>(pArg)); + m_setCmdArgsMissingInfo.push_back(pArg); else if (!pArg->GetValid()) - m_setCmdArgsThatNotValid.push_back(const_cast<CMICmdArgValBase *>(pArg)); + m_setCmdArgsThatNotValid.push_back(pArg); } else if (pArg->GetIsMandatory()) - m_setCmdArgsThatAreMissing.push_back(const_cast<CMICmdArgValBase *>(pArg)); + m_setCmdArgsThatAreMissing.push_back(pArg); } if (pArg->GetFound() && !pArg->GetIsHandledByCmd()) { m_bIsArgsPresentButNotHandledByCmd = true; - m_setCmdArgsNotHandledByCmd.push_back(const_cast<CMICmdArgValBase *>(pArg)); + m_setCmdArgsNotHandledByCmd.push_back(pArg); } // Next |