Skip to content
Snippets Groups Projects
Commit 96deddca authored by Tom Tromey's avatar Tom Tromey
Browse files

libcc1: avoid extra string copies

PR c/94669 points out that a couple of spots in libcc1 take a
std::string where a reference would do.  This changes these spots to
take a const char *, to reduce the number of copies.

libcc1

	PR c/94669
	* compiler.hh (compiler_driver_filename): Take const char *.
	(compiler_triplet_regexp): Likewise.
parent 8fdffa48
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,7 @@ namespace cc1_plugin ...@@ -58,7 +58,7 @@ namespace cc1_plugin
char *find (const char *base, std::string &compiler) const override; char *find (const char *base, std::string &compiler) const override;
compiler_triplet_regexp (bool v, std::string triplet_regexp) compiler_triplet_regexp (bool v, const char *triplet_regexp)
: compiler (v), triplet_regexp_ (triplet_regexp) : compiler (v), triplet_regexp_ (triplet_regexp)
{ {
} }
...@@ -72,7 +72,7 @@ namespace cc1_plugin ...@@ -72,7 +72,7 @@ namespace cc1_plugin
public: public:
char *find (const char *base, std::string &compiler) const override; char *find (const char *base, std::string &compiler) const override;
compiler_driver_filename (bool v, std::string driver_filename) compiler_driver_filename (bool v, const char *driver_filename)
: compiler (v), driver_filename_ (driver_filename) : compiler (v), driver_filename_ (driver_filename)
{ {
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment