summaryrefslogtreecommitdiff
path: root/libcc1
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-05-04 15:26:58 -0600
committerTom Tromey <tom@tromey.com>2021-05-05 00:08:34 -0600
commit96deddca2e535d09db1d244a96a1efc20e24b673 (patch)
tree2ea1b227fef5bbc57dd4638f7b5f01b02ae63751 /libcc1
parent8fdffa48c57f13b90556bc179150d24efdeeeef5 (diff)
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.
Diffstat (limited to 'libcc1')
-rw-r--r--libcc1/compiler.hh4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcc1/compiler.hh b/libcc1/compiler.hh
index 638f7c09f63..d10d409f9d3 100644
--- a/libcc1/compiler.hh
+++ b/libcc1/compiler.hh
@@ -58,7 +58,7 @@ namespace cc1_plugin
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)
{
}
@@ -72,7 +72,7 @@ namespace cc1_plugin
public:
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)
{
}