Skip to content

Commit

Permalink
manual const ref conversions
Browse files Browse the repository at this point in the history
clang-tidy found these but was not able to automatically fix them.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb authored and lauft committed Jun 26, 2023
1 parent 734971b commit b41bb63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Packrat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void Packrat::entity (const std::string& category, const std::string& name)
////////////////////////////////////////////////////////////////////////////////
void Packrat::external (
const std::string& rule,
bool (*fn)(Pig&, std::shared_ptr <Tree>))
bool (*fn)(Pig&, const std::shared_ptr <Tree>&))
{
if (_externals.find (rule) != _externals.end ())
throw format ("There is already an external parser defined for rule '{1}'.", rule);
Expand Down
4 changes: 2 additions & 2 deletions src/Packrat.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Packrat
public:
void parse (const PEG&, const std::string&);
void entity (const std::string&, const std::string&);
void external (const std::string&, bool (*)(Pig&, std::shared_ptr <Tree>));
void external (const std::string&, bool (*)(Pig&, const std::shared_ptr <Tree>&));

void debug ();
std::string dump () const;
Expand All @@ -62,7 +62,7 @@ class Packrat
std::map <std::string, PEG::Rule> _syntax {};
std::shared_ptr <Tree> _tree {std::make_shared <Tree> ()};
std::multimap <std::string, std::string> _entities {};
std::map <std::string, bool (*)(Pig&, std::shared_ptr <Tree>)> _externals {};
std::map <std::string, bool (*)(Pig&, const std::shared_ptr <Tree>&)> _externals {};
};

#endif
Expand Down
2 changes: 1 addition & 1 deletion test/external.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <Tree.h>

////////////////////////////////////////////////////////////////////////////////
bool externalParser (Pig& pig, std::shared_ptr <Tree> branch)
bool externalParser (Pig& pig, const std::shared_ptr <Tree>& branch)
{
if (pig.skipLiteral ("foo"))
{
Expand Down

0 comments on commit b41bb63

Please sign in to comment.