diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-27 18:30:35 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-04-17 13:36:50 +0300 |
commit | 46fa69159616860ded192643031f7cb3c10b818b (patch) | |
tree | 943a45833a3495b3c498944b9dd6f51f996a2b24 /include/mbgl/style | |
parent | 563d4b6cac0076e87bd57e5227e20689c05f44fa (diff) | |
download | qtlocation-mapboxgl-46fa69159616860ded192643031f7cb3c10b818b.tar.gz |
[core] Fix performance-unnecessary-value-param errors in header files
As reported by clang-tidy-8.
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/expression/case.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/style/expression/let.hpp | 7 | ||||
-rw-r--r-- | include/mbgl/style/expression/literal.hpp | 12 | ||||
-rw-r--r-- | include/mbgl/style/expression/match.hpp | 13 | ||||
-rw-r--r-- | include/mbgl/style/expression/parsing_context.hpp | 20 | ||||
-rw-r--r-- | include/mbgl/style/image.hpp | 11 |
6 files changed, 26 insertions, 41 deletions
diff --git a/include/mbgl/style/expression/case.hpp b/include/mbgl/style/expression/case.hpp index 7cd007d3c7..4a254dc35b 100644 --- a/include/mbgl/style/expression/case.hpp +++ b/include/mbgl/style/expression/case.hpp @@ -5,6 +5,7 @@ #include <mbgl/style/conversion.hpp> #include <memory> +#include <utility> #include <vector> namespace mbgl { @@ -16,8 +17,7 @@ public: using Branch = std::pair<std::unique_ptr<Expression>, std::unique_ptr<Expression>>; Case(type::Type type_, std::vector<Branch> branches_, std::unique_ptr<Expression> otherwise_) - : Expression(Kind::Case, type_), branches(std::move(branches_)), otherwise(std::move(otherwise_)) { - } + : Expression(Kind::Case, std::move(type_)), branches(std::move(branches_)), otherwise(std::move(otherwise_)) {} static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); diff --git a/include/mbgl/style/expression/let.hpp b/include/mbgl/style/expression/let.hpp index d11ba1b976..7c468dfeb1 100644 --- a/include/mbgl/style/expression/let.hpp +++ b/include/mbgl/style/expression/let.hpp @@ -49,11 +49,8 @@ private: class Var : public Expression { public: - Var(std::string name_, std::shared_ptr<Expression> value_) : - Expression(Kind::Var, value_->getType()), - name(std::move(name_)), - value(value_) - {} + Var(std::string name_, const std::shared_ptr<Expression>& value_) + : Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(value_) {} static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); diff --git a/include/mbgl/style/expression/literal.hpp b/include/mbgl/style/expression/literal.hpp index bcae23b1fa..f704a34a59 100644 --- a/include/mbgl/style/expression/literal.hpp +++ b/include/mbgl/style/expression/literal.hpp @@ -12,15 +12,9 @@ namespace expression { class Literal : public Expression { public: - Literal(Value value_) - : Expression(Kind::Literal, typeOf(value_)) - , value(value_) - {} - - Literal(type::Array type_, std::vector<Value> value_) - : Expression(Kind::Literal, type_) - , value(value_) - {} + Literal(const Value& value_) : Expression(Kind::Literal, typeOf(value_)), value(value_) {} + + Literal(const type::Array& type_, std::vector<Value> value_) : Expression(Kind::Literal, type_), value(value_) {} EvaluationResult evaluate(const EvaluationContext&) const override { return value; diff --git a/include/mbgl/style/expression/match.hpp b/include/mbgl/style/expression/match.hpp index 2ce4b7a533..766eec8f5a 100644 --- a/include/mbgl/style/expression/match.hpp +++ b/include/mbgl/style/expression/match.hpp @@ -15,15 +15,14 @@ class Match : public Expression { public: using Branches = std::unordered_map<T, std::shared_ptr<Expression>>; - Match(type::Type type_, + Match(const type::Type& type_, std::unique_ptr<Expression> input_, Branches branches_, - std::unique_ptr<Expression> otherwise_ - ) : Expression(Kind::Match, type_), - input(std::move(input_)), - branches(std::move(branches_)), - otherwise(std::move(otherwise_)) - {} + std::unique_ptr<Expression> otherwise_) + : Expression(Kind::Match, type_), + input(std::move(input_)), + branches(std::move(branches_)), + otherwise(std::move(otherwise_)) {} EvaluationResult evaluate(const EvaluationContext& params) const override; diff --git a/include/mbgl/style/expression/parsing_context.hpp b/include/mbgl/style/expression/parsing_context.hpp index d1e209989f..31445271a9 100644 --- a/include/mbgl/style/expression/parsing_context.hpp +++ b/include/mbgl/style/expression/parsing_context.hpp @@ -7,10 +7,11 @@ #include <iterator> #include <map> -#include <unordered_map> +#include <memory> #include <string> +#include <unordered_map> +#include <utility> #include <vector> -#include <memory> namespace mbgl { namespace style { @@ -122,22 +123,21 @@ public: Check whether `t` is a subtype of `expected`, collecting an error if not. */ optional<std::string> checkType(const type::Type& t); - - optional<std::shared_ptr<Expression>> getBinding(const std::string name) { + + optional<std::shared_ptr<Expression>> getBinding(const std::string& name) { if (!scope) return optional<std::shared_ptr<Expression>>(); return scope->get(name); } - void error(std::string message) { - errors->push_back({message, key}); - } - + void error(std::string message) { errors->push_back({std::move(message), key}); } + void error(std::string message, std::size_t child) { - errors->push_back({message, key + "[" + util::toString(child) + "]"}); + errors->push_back({std::move(message), key + "[" + util::toString(child) + "]"}); } void error(std::string message, std::size_t child, std::size_t grandchild) { - errors->push_back({message, key + "[" + util::toString(child) + "][" + util::toString(grandchild) + "]"}); + errors->push_back( + {std::move(message), key + "[" + util::toString(child) + "][" + util::toString(grandchild) + "]"}); } void appendErrors(ParsingContext&& ctx) { diff --git a/include/mbgl/style/image.hpp b/include/mbgl/style/image.hpp index d551651cd0..5783fc2468 100644 --- a/include/mbgl/style/image.hpp +++ b/include/mbgl/style/image.hpp @@ -40,14 +40,9 @@ public: float pixelRatio, ImageStretches stretchX = {}, ImageStretches stretchY = {}, - optional<ImageContent> content = nullopt) - : Image(std::move(id), - std::move(image), - pixelRatio, - false, - std::move(stretchX), - std::move(stretchY), - content) {} + const optional<ImageContent>& content = nullopt) + : Image(std::move(id), std::move(image), pixelRatio, false, std::move(stretchX), std::move(stretchY), content) { + } Image(const Image&); std::string getID() const; |