diff --git a/src/macro/Directives.hh b/src/macro/Directives.hh index a6b99038be3a0d78f91eacc35839a029011792c4..9e8f131053720fe7d3279fd1101a329f7ab120cd 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 7ae6b8379a6d2ba26b7f0a98e0afe5b03050274c..757dacdfde841c9d7d494a05ede8346916bd574a 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<ExpressionPtr> getValue() const { return tup; } - inline ExpressionPtr at(int i) const { return tup.at(i); } + inline const vector<ExpressionPtr> & 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<Bool>(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<ExpressionPtr> getValue() const { return arr; } - inline ExpressionPtr at(int i) const { return arr.at(i); } + inline const vector<ExpressionPtr> & 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<Variable>(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<ExpressionPtr> getArgs() const { return args; } + inline const string & getName() const { return name; } + inline const vector<ExpressionPtr> & getArgs() const { return args; } };