diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Symbol/VariableList.cpp | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Symbol/VariableList.cpp')
-rw-r--r-- | lldb/source/Symbol/VariableList.cpp | 346 |
1 files changed, 147 insertions, 199 deletions
diff --git a/lldb/source/Symbol/VariableList.cpp b/lldb/source/Symbol/VariableList.cpp index 487c5719434..a81b95b7937 100644 --- a/lldb/source/Symbol/VariableList.cpp +++ b/lldb/source/Symbol/VariableList.cpp @@ -11,8 +11,8 @@ #include "lldb/Core/RegularExpression.h" #include "lldb/Symbol/Block.h" -#include "lldb/Symbol/Function.h" #include "lldb/Symbol/CompileUnit.h" +#include "lldb/Symbol/Function.h" using namespace lldb; using namespace lldb_private; @@ -20,214 +20,162 @@ using namespace lldb_private; //---------------------------------------------------------------------- // VariableList constructor //---------------------------------------------------------------------- -VariableList::VariableList() : - m_variables() -{ -} +VariableList::VariableList() : m_variables() {} //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- -VariableList::~VariableList() -{ -} - -void -VariableList::AddVariable(const VariableSP &var_sp) -{ - m_variables.push_back(var_sp); -} - -bool -VariableList::AddVariableIfUnique (const lldb::VariableSP &var_sp) -{ - if (FindVariableIndex (var_sp) == UINT32_MAX) - { - m_variables.push_back(var_sp); - return true; - } - return false; -} +VariableList::~VariableList() {} -void -VariableList::AddVariables(VariableList *variable_list) -{ - if (variable_list) - { - std::copy(variable_list->m_variables.begin(), // source begin - variable_list->m_variables.end(), // source end - back_inserter(m_variables)); // destination - } -} - -void -VariableList::Clear() -{ - m_variables.clear(); -} - -VariableSP -VariableList::GetVariableAtIndex(size_t idx) const -{ - VariableSP var_sp; - if (idx < m_variables.size()) - var_sp = m_variables[idx]; - return var_sp; +void VariableList::AddVariable(const VariableSP &var_sp) { + m_variables.push_back(var_sp); } -VariableSP -VariableList::RemoveVariableAtIndex(size_t idx) -{ - VariableSP var_sp; - if (idx < m_variables.size()) - { - var_sp = m_variables[idx]; - m_variables.erase (m_variables.begin() + idx); - } - return var_sp; -} - -uint32_t -VariableList::FindVariableIndex (const VariableSP &var_sp) -{ - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if (pos->get() == var_sp.get()) - return std::distance (m_variables.begin(), pos); +bool VariableList::AddVariableIfUnique(const lldb::VariableSP &var_sp) { + if (FindVariableIndex(var_sp) == UINT32_MAX) { + m_variables.push_back(var_sp); + return true; + } + return false; +} + +void VariableList::AddVariables(VariableList *variable_list) { + if (variable_list) { + std::copy(variable_list->m_variables.begin(), // source begin + variable_list->m_variables.end(), // source end + back_inserter(m_variables)); // destination + } +} + +void VariableList::Clear() { m_variables.clear(); } + +VariableSP VariableList::GetVariableAtIndex(size_t idx) const { + VariableSP var_sp; + if (idx < m_variables.size()) + var_sp = m_variables[idx]; + return var_sp; +} + +VariableSP VariableList::RemoveVariableAtIndex(size_t idx) { + VariableSP var_sp; + if (idx < m_variables.size()) { + var_sp = m_variables[idx]; + m_variables.erase(m_variables.begin() + idx); + } + return var_sp; +} + +uint32_t VariableList::FindVariableIndex(const VariableSP &var_sp) { + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if (pos->get() == var_sp.get()) + return std::distance(m_variables.begin(), pos); + } + return UINT32_MAX; +} + +VariableSP VariableList::FindVariable(const ConstString &name, + bool include_static_members) { + VariableSP var_sp; + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if ((*pos)->NameMatches(name)) { + if (include_static_members || !(*pos)->IsStaticMember()) { + var_sp = (*pos); + break; + } } - return UINT32_MAX; -} - -VariableSP -VariableList::FindVariable(const ConstString& name, bool include_static_members) -{ - VariableSP var_sp; - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if ((*pos)->NameMatches(name)) - { - if (include_static_members || !(*pos)->IsStaticMember()) - { - var_sp = (*pos); - break; - } - } + } + return var_sp; +} + +VariableSP VariableList::FindVariable(const ConstString &name, + lldb::ValueType value_type, + bool include_static_members) { + VariableSP var_sp; + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if ((*pos)->NameMatches(name) && (*pos)->GetScope() == value_type) { + if (include_static_members || !(*pos)->IsStaticMember()) { + var_sp = (*pos); + break; + } } - return var_sp; -} - -VariableSP -VariableList::FindVariable (const ConstString& name, lldb::ValueType value_type, bool include_static_members) -{ - VariableSP var_sp; - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if ((*pos)->NameMatches(name) && (*pos)->GetScope() == value_type) - { - if (include_static_members || !(*pos)->IsStaticMember()) - { - var_sp = (*pos); - break; - } - } + } + return var_sp; +} + +size_t VariableList::AppendVariablesIfUnique(VariableList &var_list) { + const size_t initial_size = var_list.GetSize(); + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) + var_list.AddVariableIfUnique(*pos); + return var_list.GetSize() - initial_size; +} + +size_t VariableList::AppendVariablesIfUnique(const RegularExpression ®ex, + VariableList &var_list, + size_t &total_matches) { + const size_t initial_size = var_list.GetSize(); + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if ((*pos)->NameMatches(regex)) { + // Note the total matches found + total_matches++; + // Only add this variable if it isn't already in the "var_list" + var_list.AddVariableIfUnique(*pos); } - return var_sp; -} - -size_t -VariableList::AppendVariablesIfUnique(VariableList &var_list) -{ - const size_t initial_size = var_list.GetSize(); - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) + } + // Return the number of new unique variables added to "var_list" + return var_list.GetSize() - initial_size; +} + +size_t VariableList::AppendVariablesWithScope(lldb::ValueType type, + VariableList &var_list, + bool if_unique) { + const size_t initial_size = var_list.GetSize(); + iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if ((*pos)->GetScope() == type) { + if (if_unique) var_list.AddVariableIfUnique(*pos); - return var_list.GetSize() - initial_size; -} - -size_t -VariableList::AppendVariablesIfUnique (const RegularExpression& regex, VariableList &var_list, size_t& total_matches) -{ - const size_t initial_size = var_list.GetSize(); - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if ((*pos)->NameMatches (regex)) - { - // Note the total matches found - total_matches++; - // Only add this variable if it isn't already in the "var_list" - var_list.AddVariableIfUnique (*pos); - } - } - // Return the number of new unique variables added to "var_list" - return var_list.GetSize() - initial_size; -} - -size_t -VariableList::AppendVariablesWithScope (lldb::ValueType type, - VariableList &var_list, - bool if_unique) -{ - const size_t initial_size = var_list.GetSize(); - iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if ((*pos)->GetScope() == type) - { - if (if_unique) - var_list.AddVariableIfUnique (*pos); - else - var_list.AddVariable(*pos); - } - } - // Return the number of new unique variables added to "var_list" - return var_list.GetSize() - initial_size; -} - -uint32_t -VariableList::FindIndexForVariable (Variable* variable) -{ - VariableSP var_sp; - iterator pos; - const iterator begin = m_variables.begin(); - const iterator end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - if ((*pos).get() == variable) - return std::distance (begin, pos); - } - return UINT32_MAX; -} - -size_t -VariableList::MemorySize() const -{ - size_t mem_size = sizeof(VariableList); - const_iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - mem_size += (*pos)->MemorySize(); - return mem_size; -} - -size_t -VariableList::GetSize() const -{ - return m_variables.size(); -} - -void -VariableList::Dump(Stream *s, bool show_context) const -{ -// s.Printf("%.*p: ", (int)sizeof(void*) * 2, this); -// s.Indent(); -// s << "VariableList\n"; - - const_iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - (*pos)->Dump(s, show_context); + else + var_list.AddVariable(*pos); } + } + // Return the number of new unique variables added to "var_list" + return var_list.GetSize() - initial_size; +} + +uint32_t VariableList::FindIndexForVariable(Variable *variable) { + VariableSP var_sp; + iterator pos; + const iterator begin = m_variables.begin(); + const iterator end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + if ((*pos).get() == variable) + return std::distance(begin, pos); + } + return UINT32_MAX; +} + +size_t VariableList::MemorySize() const { + size_t mem_size = sizeof(VariableList); + const_iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) + mem_size += (*pos)->MemorySize(); + return mem_size; +} + +size_t VariableList::GetSize() const { return m_variables.size(); } + +void VariableList::Dump(Stream *s, bool show_context) const { + // s.Printf("%.*p: ", (int)sizeof(void*) * 2, this); + // s.Indent(); + // s << "VariableList\n"; + + const_iterator pos, end = m_variables.end(); + for (pos = m_variables.begin(); pos != end; ++pos) { + (*pos)->Dump(s, show_context); + } } |