diff --git a/src/macro/Directives.hh b/src/macro/Directives.hh index a6b99038..9e8f1310 100644 --- a/src/macro/Directives.hh +++ b/src/macro/Directives.hh @@ -71,7 +71,7 @@ namespace macro Include(ExpressionPtr expr_arg, Environment &env_arg, Tokenizer::location location_arg) : Directive(env_arg, move(location_arg)), expr{move(expr_arg)} { } void interpret(ostream &output, bool no_line_macro) override; - inline string getName() const { return name; } + inline const string & getName() const { return name; } }; @@ -84,7 +84,7 @@ namespace macro IncludePath(ExpressionPtr expr_arg, Environment &env_arg, Tokenizer::location location_arg) : Directive(env_arg, move(location_arg)), expr{move(expr_arg)} { } void interpret(ostream &output, bool no_line_macro) override; - inline string getPath() const { return path; } + inline const string & getPath() const { return path; } }; diff --git a/src/macro/Expressions.hh b/src/macro/Expressions.hh index 7ae6b837..757dacdf 100644 --- a/src/macro/Expressions.hh +++ b/src/macro/Expressions.hh @@ -378,8 +378,8 @@ namespace macro public: inline size_t size() const { return tup.size(); } inline bool empty() const { return tup.empty(); } - inline vector getValue() const { return tup; } - inline ExpressionPtr at(int i) const { return tup.at(i); } + inline const vector & getValue() const { return tup; } + inline const ExpressionPtr & at(int i) const { return tup.at(i); } BoolPtr is_equal(const BaseTypePtr &btp) const override; inline BoolPtr istuple() const override { return make_shared(true, env, location); } BoolPtr contains(const BaseTypePtr &btp) const override; @@ -418,8 +418,8 @@ namespace macro ExpressionPtr clone() const noexcept override; public: inline size_t size() const { return arr.size(); } - inline vector getValue() const { return arr; } - inline ExpressionPtr at(int i) const { return arr.at(i); } + inline const vector & getValue() const { return arr; } + inline const ExpressionPtr & at(int i) const { return arr.at(i); } inline bool empty() const { return arr.empty() && !range1 && !range2; } BaseTypePtr plus(const BaseTypePtr &bt) const override; BaseTypePtr minus(const BaseTypePtr &bt) const override; @@ -466,7 +466,7 @@ namespace macro make_shared(name, env, location); } public: - inline string getName() const noexcept { return name; } + inline const string & getName() const noexcept { return name; } inline codes::BaseType getType() const { return env.getType(name); } }; @@ -491,8 +491,8 @@ namespace macro public: inline void printName(ostream &output) const noexcept { output << name; } void printArgs(ostream &output) const noexcept; - inline string getName() const { return name; } - inline vector getArgs() const { return args; } + inline const string & getName() const { return name; } + inline const vector & getArgs() const { return args; } };