Skip to content

Commit

Permalink
Add findModulesByName(std::string const&) (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Sep 29, 2023
1 parent 8d221c3 commit 18b0f40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions symtabAPI/doc/API/Symtab/Symtab.tex
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ \subsubsection{Module lookup}
This method searches for a module with name \code{name}. If the module exists returns \code{true} with \code{ret} set to the module handle; otherwise returns \code{false} with \code{ret} set to \code{NULL}.
}

\begin{apient}
std::vector<Module*> findModulesByName(std::string const& name) const
\end{apient}
\apidesc{
Retrieve all modules with name \code{name}.
}

\begin{apient}
Module* findModuleByOffset(Offset offset) const
\end{apient}
Expand Down
1 change: 1 addition & 0 deletions symtabAPI/h/Symtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class SYMTAB_EXPORT Symtab : public LookupInterface,
/*[[deprecated]]*/ bool findModuleByOffset(Module *& ret, Offset off);
Module* findModuleByOffset(Offset offset) const;
bool findModuleByName(Module *&ret, const std::string name);
std::vector<Module*> findModulesByName(std::string const& name) const;
Module *getDefaultModule() const;

// Region
Expand Down
4 changes: 4 additions & 0 deletions symtabAPI/src/Symtab-lookup.C
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ bool Symtab::findModuleByName(Module *&ret, const std::string name)
return false;
}

std::vector<Module*> Symtab::findModulesByName(std::string const& name) const {
return impl->modules.find(name);
}

bool Symtab::getAllRegions(std::vector<Region *>&ret)
{
if (regions_.size() > 0)
Expand Down

0 comments on commit 18b0f40

Please sign in to comment.