Skip to content

Commit

Permalink
[lldb][nfc] remove overriden funcs with default impl
Browse files Browse the repository at this point in the history
Summary:
These `SearchFilter` methods all return `true` by their default
implementation:

```lang=c++
virtual bool ModulePasses(const FileSpec &spec);
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
virtual bool AddressPasses(Address &addr);
virtual bool CompUnitPasses(FileSpec &fileSpec);
virtual bool CompUnitPasses(CompileUnit &compUnit);
```

That's why I've documented the default behavior and remove the overrides
(except for `AddressPasses`) in these `SearchFilter`-subclasses which all just
repeated the default implementation: `SearchFilterByModule`,
`SearchFilterByModuleList`.

Reviewers: jankratochvil, labath

Reviewed By: jankratochvil, labath

Subscribers: labath, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77376
  • Loading branch information
kwk committed Apr 6, 2020
1 parent f8e1fc2 commit 9072df8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
18 changes: 10 additions & 8 deletions lldb/include/lldb/Core/SearchFilter.h
Expand Up @@ -98,6 +98,8 @@ class SearchFilter {
/// The file spec to check against the filter.
/// \return
/// \b true if \a spec passes, and \b false otherwise.
///
/// \note the default implementation always returns \c true.
virtual bool ModulePasses(const FileSpec &spec);

/// Call this method with a Module to see if that module passes the filter.
Expand All @@ -107,6 +109,8 @@ class SearchFilter {
///
/// \return
/// \b true if \a module passes, and \b false otherwise.
///
/// \note the default implementation always returns \c true.
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);

/// Call this method with a Address to see if \a address passes the filter.
Expand All @@ -116,6 +120,8 @@ class SearchFilter {
///
/// \return
/// \b true if \a address passes, and \b false otherwise.
///
/// \note the default implementation always returns \c true.
virtual bool AddressPasses(Address &addr);

/// Call this method with a FileSpec to see if \a file spec passes the
Expand All @@ -126,6 +132,8 @@ class SearchFilter {
///
/// \return
/// \b true if \a file spec passes, and \b false otherwise.
///
/// \note the default implementation always returns \c true.
virtual bool CompUnitPasses(FileSpec &fileSpec);

/// Call this method with a CompileUnit to see if \a comp unit passes the
Expand All @@ -136,6 +144,8 @@ class SearchFilter {
///
/// \return
/// \b true if \a Comp Unit passes, and \b false otherwise.
///
/// \note the default implementation always returns \c true.
virtual bool CompUnitPasses(CompileUnit &compUnit);

/// Call this method with a Function to see if \a function passes the
Expand Down Expand Up @@ -321,10 +331,6 @@ class SearchFilterByModule : public SearchFilter {

bool AddressPasses(Address &address) override;

bool CompUnitPasses(FileSpec &fileSpec) override;

bool CompUnitPasses(CompileUnit &compUnit) override;

void GetDescription(Stream *s) override;

uint32_t GetFilterRequiredItems() override;
Expand Down Expand Up @@ -372,10 +378,6 @@ class SearchFilterByModuleList : public SearchFilter {

bool AddressPasses(Address &address) override;

bool CompUnitPasses(FileSpec &fileSpec) override;

bool CompUnitPasses(CompileUnit &compUnit) override;

void GetDescription(Stream *s) override;

uint32_t GetFilterRequiredItems() override;
Expand Down
14 changes: 0 additions & 14 deletions lldb/source/Core/SearchFilter.cpp
Expand Up @@ -417,12 +417,6 @@ bool SearchFilterByModule::AddressPasses(Address &address) {
return true;
}

bool SearchFilterByModule::CompUnitPasses(FileSpec &fileSpec) { return true; }

bool SearchFilterByModule::CompUnitPasses(CompileUnit &compUnit) {
return true;
}

void SearchFilterByModule::Search(Searcher &searcher) {
if (!m_target_sp)
return;
Expand Down Expand Up @@ -543,14 +537,6 @@ bool SearchFilterByModuleList::AddressPasses(Address &address) {
return true;
}

bool SearchFilterByModuleList::CompUnitPasses(FileSpec &fileSpec) {
return true;
}

bool SearchFilterByModuleList::CompUnitPasses(CompileUnit &compUnit) {
return true;
}

void SearchFilterByModuleList::Search(Searcher &searcher) {
if (!m_target_sp)
return;
Expand Down

0 comments on commit 9072df8

Please sign in to comment.