diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-20 12:38:09 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-23 12:09:09 +0200 |
commit | d15b9c1f9c1afa29175ba2e398adc680e66147e6 (patch) | |
tree | 6bf426ae77d7386a6bbdee30444974bbc5dd76d0 /include | |
parent | 37802eec36aae3cb84c7f73a48652d9959489243 (diff) | |
download | qtlocation-mapboxgl-d15b9c1f9c1afa29175ba2e398adc680e66147e6.tar.gz |
[core] Fix performance-unnecessary-value-param errors
As reported by clang-tidy-8.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/actor/mailbox.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/i18n/collator.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 19 | ||||
-rw-r--r-- | include/mbgl/platform/settings.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/renderer/renderer.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/storage/database_file_source.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/expression/collator.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/expression/comparison.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/style/expression/compound_expression.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/expression/dsl.hpp | 8 | ||||
-rw-r--r-- | include/mbgl/style/expression/parsing_context.hpp | 11 | ||||
-rw-r--r-- | include/mbgl/style/image.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/sources/custom_geometry_source.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/sources/geojson_source.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/string.hpp | 2 |
15 files changed, 36 insertions, 29 deletions
diff --git a/include/mbgl/actor/mailbox.hpp b/include/mbgl/actor/mailbox.hpp index 1e18d593d3..86ea0100fc 100644 --- a/include/mbgl/actor/mailbox.hpp +++ b/include/mbgl/actor/mailbox.hpp @@ -36,7 +36,7 @@ public: void push(std::unique_ptr<Message>); void receive(); - static void maybeReceive(std::weak_ptr<Mailbox>); + static void maybeReceive(const std::weak_ptr<Mailbox>&); static std::function<void()> makeClosure(std::weak_ptr<Mailbox>); private: diff --git a/include/mbgl/i18n/collator.hpp b/include/mbgl/i18n/collator.hpp index 9db1f804aa..69afbae7d4 100644 --- a/include/mbgl/i18n/collator.hpp +++ b/include/mbgl/i18n/collator.hpp @@ -10,7 +10,7 @@ namespace platform { class Collator { public: - explicit Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale = nullopt); + explicit Collator(bool caseSensitive, bool diacriticSensitive, const optional<std::string>& locale = nullopt); int compare(const std::string& lhs, const std::string& rhs) const; std::string resolvedLocale() const; bool operator==(const Collator& other) const; diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 62bb39e8c2..9aa0cb165e 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -60,17 +60,26 @@ public: bool isPanning() const; // Camera - CameraOptions getCameraOptions(optional<EdgeInsets> = {}) const; + CameraOptions getCameraOptions(const optional<EdgeInsets>& = {}) const; void jumpTo(const CameraOptions&); void easeTo(const CameraOptions&, const AnimationOptions&); void flyTo(const CameraOptions&, const AnimationOptions&); void moveBy(const ScreenCoordinate&, const AnimationOptions& = {}); - void scaleBy(double scale, optional<ScreenCoordinate> anchor, const AnimationOptions& animation = {}); + void scaleBy(double scale, const optional<ScreenCoordinate>& anchor, const AnimationOptions& animation = {}); void pitchBy(double pitch, const AnimationOptions& animation = {}); void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& = {}); - CameraOptions cameraForLatLngBounds(const LatLngBounds&, const EdgeInsets&, optional<double> bearing = {}, optional<double> pitch = {}) const; - CameraOptions cameraForLatLngs(const std::vector<LatLng>&, const EdgeInsets&, optional<double> bearing = {}, optional<double> pitch = {}) const; - CameraOptions cameraForGeometry(const Geometry<double>&, const EdgeInsets&, optional<double> bearing = {}, optional<double> pitch = {}) const; + CameraOptions cameraForLatLngBounds(const LatLngBounds&, + const EdgeInsets&, + const optional<double>& bearing = {}, + const optional<double>& pitch = {}) const; + CameraOptions cameraForLatLngs(const std::vector<LatLng>&, + const EdgeInsets&, + const optional<double>& bearing = {}, + const optional<double>& pitch = {}) const; + CameraOptions cameraForGeometry(const Geometry<double>&, + const EdgeInsets&, + const optional<double>& bearing = {}, + const optional<double>& pitch = {}) const; LatLngBounds latLngBoundsForCamera(const CameraOptions&) const; LatLngBounds latLngBoundsForCameraUnwrapped(const CameraOptions&) const; diff --git a/include/mbgl/platform/settings.hpp b/include/mbgl/platform/settings.hpp index 80bfe1d60f..722d0d2b3b 100644 --- a/include/mbgl/platform/settings.hpp +++ b/include/mbgl/platform/settings.hpp @@ -26,7 +26,7 @@ public: // Sets multiple setting values by merging current Settings object // with provided `values` object. - void set(mapbox::base::ValueObject values) noexcept; + void set(const mapbox::base::ValueObject& values) noexcept; // Returns setting value for a specified key or NullValue if element // for specified key is missing. diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp index 1d71a016b6..79782839ee 100644 --- a/include/mbgl/renderer/renderer.hpp +++ b/include/mbgl/renderer/renderer.hpp @@ -23,8 +23,7 @@ class RendererBackend; class Renderer { public: - Renderer(gfx::RendererBackend&, float pixelRatio_, - const optional<std::string> localFontFamily = {}); + Renderer(gfx::RendererBackend&, float pixelRatio_, const optional<std::string>& localFontFamily = {}); ~Renderer(); void markContextLost(); diff --git a/include/mbgl/storage/database_file_source.hpp b/include/mbgl/storage/database_file_source.hpp index 81e5315fd8..31079fcc3d 100644 --- a/include/mbgl/storage/database_file_source.hpp +++ b/include/mbgl/storage/database_file_source.hpp @@ -216,7 +216,7 @@ public: * executed on the database thread; it is the responsibility of the SDK bindings * to re-execute a user-provided callback on the main thread. */ - virtual void deleteOfflineRegion(OfflineRegion, std::function<void(std::exception_ptr)>); + virtual void deleteOfflineRegion(OfflineRegion&, std::function<void(std::exception_ptr)>); /* * Invalidate all the tiles from an offline region forcing Mapbox GL to revalidate diff --git a/include/mbgl/style/expression/collator.hpp b/include/mbgl/style/expression/collator.hpp index 51ba426fad..95a072618a 100644 --- a/include/mbgl/style/expression/collator.hpp +++ b/include/mbgl/style/expression/collator.hpp @@ -11,7 +11,7 @@ namespace expression { class Collator { public: - Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale = {}); + Collator(bool caseSensitive, bool diacriticSensitive, const optional<std::string>& locale = {}); bool operator==(const Collator& other) const; diff --git a/include/mbgl/style/expression/comparison.hpp b/include/mbgl/style/expression/comparison.hpp index cf64f5cd34..df1fbcab9e 100644 --- a/include/mbgl/style/expression/comparison.hpp +++ b/include/mbgl/style/expression/comparison.hpp @@ -15,7 +15,7 @@ ParseResult parseComparison(const mbgl::style::conversion::Convertible&, Parsing class BasicComparison : public Expression { public: - using CompareFunctionType = bool (*) (Value, Value); + using CompareFunctionType = bool (*)(const Value&, const Value&); BasicComparison( std::string op, @@ -38,7 +38,7 @@ private: class CollatorComparison : public Expression { public: - using CompareFunctionType = bool (*) (std::string, std::string, Collator); + using CompareFunctionType = bool (*)(const std::string&, const std::string&, const Collator&); CollatorComparison( std::string op, diff --git a/include/mbgl/style/expression/compound_expression.hpp b/include/mbgl/style/expression/compound_expression.hpp index 57a96d08a0..c6c66c3fc6 100644 --- a/include/mbgl/style/expression/compound_expression.hpp +++ b/include/mbgl/style/expression/compound_expression.hpp @@ -46,7 +46,7 @@ protected: std::vector<std::unique_ptr<Expression>> args; }; -ParseResult parseCompoundExpression(const std::string name, +ParseResult parseCompoundExpression(const std::string& name, const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); diff --git a/include/mbgl/style/expression/dsl.hpp b/include/mbgl/style/expression/dsl.hpp index 347861abc9..6bb1d22d64 100644 --- a/include/mbgl/style/expression/dsl.hpp +++ b/include/mbgl/style/expression/dsl.hpp @@ -29,13 +29,13 @@ std::unique_ptr<Expression> createExpression(const mbgl::style::conversion::Conv std::unique_ptr<Expression> error(std::string); std::unique_ptr<Expression> literal(const char* value); -std::unique_ptr<Expression> literal(Value value); +std::unique_ptr<Expression> literal(const Value& value); std::unique_ptr<Expression> literal(std::initializer_list<double> value); std::unique_ptr<Expression> literal(std::initializer_list<const char*> value); -std::unique_ptr<Expression> -assertion(type::Type, std::unique_ptr<Expression>, - std::unique_ptr<Expression> def = nullptr); +std::unique_ptr<Expression> assertion(const type::Type&, + std::unique_ptr<Expression>, + std::unique_ptr<Expression> def = nullptr); std::unique_ptr<Expression> number(std::unique_ptr<Expression>, std::unique_ptr<Expression> def = nullptr); std::unique_ptr<Expression> string(std::unique_ptr<Expression>, diff --git a/include/mbgl/style/expression/parsing_context.hpp b/include/mbgl/style/expression/parsing_context.hpp index 596b136419..40da7c26d0 100644 --- a/include/mbgl/style/expression/parsing_context.hpp +++ b/include/mbgl/style/expression/parsing_context.hpp @@ -93,7 +93,7 @@ public: Parse the given style-spec JSON value as an expression. */ ParseResult parseExpression(const mbgl::style::conversion::Convertible& value, - optional<TypeAnnotationOption> = {}); + const optional<TypeAnnotationOption>& = {}); /* Parse the given style-spec JSON value as an expression intended to be used @@ -108,8 +108,8 @@ public: ParseResult parse(const mbgl::style::conversion::Convertible&, std::size_t, optional<type::Type> = {}, - optional<TypeAnnotationOption> = {}); - + const optional<TypeAnnotationOption>& = {}); + /* Parse a child expression. For use by individual Expression::parse() methods. */ @@ -168,9 +168,8 @@ private: type (either Literal, or the one named in value[0]) and dispatching to the appropriate ParseXxxx::parse(const V&, ParsingContext) method. */ - ParseResult parse(const mbgl::style::conversion::Convertible& value, - optional<TypeAnnotationOption> = {}); - + ParseResult parse(const mbgl::style::conversion::Convertible& value, const optional<TypeAnnotationOption>& = {}); + std::string key; optional<type::Type> expected; std::shared_ptr<detail::Scope> scope; diff --git a/include/mbgl/style/image.hpp b/include/mbgl/style/image.hpp index dd62d9e0ae..deb4b6f6ce 100644 --- a/include/mbgl/style/image.hpp +++ b/include/mbgl/style/image.hpp @@ -34,7 +34,7 @@ public: bool sdf, ImageStretches stretchX = {}, ImageStretches stretchY = {}, - optional<ImageContent> content = nullopt); + const optional<ImageContent>& content = nullopt); Image(std::string id, PremultipliedImage&& image, float pixelRatio, diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp index 504ec42ea8..250886c209 100644 --- a/include/mbgl/style/sources/custom_geometry_source.hpp +++ b/include/mbgl/style/sources/custom_geometry_source.hpp @@ -37,7 +37,7 @@ public: TileOptions tileOptions; }; public: - CustomGeometrySource(std::string id, CustomGeometrySource::Options options); + CustomGeometrySource(std::string id, const CustomGeometrySource::Options& options); ~CustomGeometrySource() final; void loadDescription(FileSource&) final; void setTileData(const CanonicalTileID&, const GeoJSON&); diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp index 7c75433c6a..9cfcade0ed 100644 --- a/include/mbgl/style/sources/geojson_source.hpp +++ b/include/mbgl/style/sources/geojson_source.hpp @@ -42,7 +42,7 @@ public: using TileFeatures = mapbox::feature::feature_collection<int16_t>; using Features = mapbox::feature::feature_collection<double>; static std::shared_ptr<GeoJSONData> create(const GeoJSON&, - Immutable<GeoJSONOptions> = GeoJSONOptions::defaultOptions(), + const Immutable<GeoJSONOptions>& = GeoJSONOptions::defaultOptions(), std::shared_ptr<Scheduler> scheduler = nullptr); virtual ~GeoJSONData() = default; diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp index 1e0f512ba8..27c3943c5f 100644 --- a/include/mbgl/util/string.hpp +++ b/include/mbgl/util/string.hpp @@ -65,7 +65,7 @@ inline std::string toString(long double t, bool decimal = false) { return toString(static_cast<double>(t), decimal); } -std::string toString(std::exception_ptr); +std::string toString(const std::exception_ptr &); template <class T> std::string toString(T) = delete; |