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/Breakpoint/BreakpointResolverFileRegex.cpp | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2 |
*** 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/Breakpoint/BreakpointResolverFileRegex.cpp')
-rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp | 166 |
1 files changed, 72 insertions, 94 deletions
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp index ae7f58a..8d08908 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -1,4 +1,5 @@ -//===-- BreakpointResolverFileRegex.cpp --------------------------*- C++ -*-===// +//===-- BreakpointResolverFileRegex.cpp --------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -14,8 +15,8 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointLocation.h" -#include "lldb/Core/SourceManager.h" #include "lldb/Core/Log.h" +#include "lldb/Core/SourceManager.h" #include "lldb/Core/StreamString.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/Target.h" @@ -26,113 +27,90 @@ using namespace lldb_private; //---------------------------------------------------------------------- // BreakpointResolverFileRegex: //---------------------------------------------------------------------- -BreakpointResolverFileRegex::BreakpointResolverFileRegex -( - Breakpoint *bkpt, - RegularExpression ®ex, - const std::unordered_set<std::string> &func_names, - bool exact_match -) : - BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver), - m_regex (regex), - m_exact_match (exact_match), - m_function_names(func_names) -{ +BreakpointResolverFileRegex::BreakpointResolverFileRegex( + Breakpoint *bkpt, RegularExpression ®ex, + const std::unordered_set<std::string> &func_names, bool exact_match) + : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver), + m_regex(regex), m_exact_match(exact_match), m_function_names(func_names) { } -BreakpointResolverFileRegex::~BreakpointResolverFileRegex () -{ -} +BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {} Searcher::CallbackReturn -BreakpointResolverFileRegex::SearchCallback -( - SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool containing -) -{ - - assert (m_breakpoint != NULL); - if (!context.target_sp) - return eCallbackReturnContinue; - - CompileUnit *cu = context.comp_unit; - FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu)); - std::vector<uint32_t> line_matches; - context.target_sp->GetSourceManager().FindLinesMatchingRegex(cu_file_spec, m_regex, 1, UINT32_MAX, line_matches); - - uint32_t num_matches = line_matches.size(); - for (uint32_t i = 0; i < num_matches; i++) - { - SymbolContextList sc_list; - const bool search_inlines = false; - - cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, m_exact_match, eSymbolContextEverything, sc_list); - // Find all the function names: - if (!m_function_names.empty()) - { - std::vector<size_t> sc_to_remove; - for (size_t i = 0; i < sc_list.GetSize(); i++) - { - SymbolContext sc_ctx; - sc_list.GetContextAtIndex(i, sc_ctx); - std::string name(sc_ctx.GetFunctionName(Mangled::NamePreference::ePreferDemangledWithoutArguments).AsCString()); - if (!m_function_names.count(name)) - { - sc_to_remove.push_back(i); - } - } - - if (!sc_to_remove.empty()) - { - std::vector<size_t>::reverse_iterator iter; - std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend(); - for (iter = sc_to_remove.rbegin(); iter != rend; iter++) - { - sc_list.RemoveContextAtIndex(*iter); - } - } +BreakpointResolverFileRegex::SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, bool containing) { + + assert(m_breakpoint != NULL); + if (!context.target_sp) + return eCallbackReturnContinue; + + CompileUnit *cu = context.comp_unit; + FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu)); + std::vector<uint32_t> line_matches; + context.target_sp->GetSourceManager().FindLinesMatchingRegex( + cu_file_spec, m_regex, 1, UINT32_MAX, line_matches); + + uint32_t num_matches = line_matches.size(); + for (uint32_t i = 0; i < num_matches; i++) { + SymbolContextList sc_list; + const bool search_inlines = false; + + cu->ResolveSymbolContext(cu_file_spec, line_matches[i], search_inlines, + m_exact_match, eSymbolContextEverything, sc_list); + // Find all the function names: + if (!m_function_names.empty()) { + std::vector<size_t> sc_to_remove; + for (size_t i = 0; i < sc_list.GetSize(); i++) { + SymbolContext sc_ctx; + sc_list.GetContextAtIndex(i, sc_ctx); + std::string name( + sc_ctx + .GetFunctionName( + Mangled::NamePreference::ePreferDemangledWithoutArguments) + .AsCString()); + if (!m_function_names.count(name)) { + sc_to_remove.push_back(i); + } + } + + if (!sc_to_remove.empty()) { + std::vector<size_t>::reverse_iterator iter; + std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend(); + for (iter = sc_to_remove.rbegin(); iter != rend; iter++) { + sc_list.RemoveContextAtIndex(*iter); } - - const bool skip_prologue = true; - - BreakpointResolver::SetSCMatchesByLine (filter, sc_list, skip_prologue, m_regex.GetText()); + } } - assert (m_breakpoint != NULL); - return Searcher::eCallbackReturnContinue; -} + const bool skip_prologue = true; -Searcher::Depth -BreakpointResolverFileRegex::GetDepth() -{ - return Searcher::eDepthCompUnit; -} + BreakpointResolver::SetSCMatchesByLine(filter, sc_list, skip_prologue, + m_regex.GetText()); + } + assert(m_breakpoint != NULL); -void -BreakpointResolverFileRegex::GetDescription (Stream *s) -{ - s->Printf ("source regex = \"%s\", exact_match = %d", m_regex.GetText(), m_exact_match); + return Searcher::eCallbackReturnContinue; } -void -BreakpointResolverFileRegex::Dump (Stream *s) const -{ +Searcher::Depth BreakpointResolverFileRegex::GetDepth() { + return Searcher::eDepthCompUnit; +} +void BreakpointResolverFileRegex::GetDescription(Stream *s) { + s->Printf("source regex = \"%s\", exact_match = %d", m_regex.GetText(), + m_exact_match); } +void BreakpointResolverFileRegex::Dump(Stream *s) const {} + lldb::BreakpointResolverSP -BreakpointResolverFileRegex::CopyForBreakpoint (Breakpoint &breakpoint) -{ - lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex, m_function_names, m_exact_match)); - return ret_sp; +BreakpointResolverFileRegex::CopyForBreakpoint(Breakpoint &breakpoint) { + lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex( + &breakpoint, m_regex, m_function_names, m_exact_match)); + return ret_sp; } -void -BreakpointResolverFileRegex::AddFunctionName(const char *func_name) -{ - m_function_names.insert(func_name); +void BreakpointResolverFileRegex::AddFunctionName(const char *func_name) { + m_function_names.insert(func_name); } - |