summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2020-05-26 17:59:26 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2020-05-26 20:37:08 +0300
commite953a9c4cb401bc9aaeb135525f9dbefc3ca5687 (patch)
tree56dcb33f4a5a37f82ae3b1ea95c8f5428959f90f
parentb99121ff0f4309e1e9fe5a38c010419d606e9b9b (diff)
downloadqtlocation-mapboxgl-upstream/tmpsantos-release_branch.tar.gz
[core] Fix clang-tidy errorsupstream/tmpsantos-release_branch
Mostly "modernize", "readability" and "performance".
-rw-r--r--include/mbgl/storage/offline.hpp2
-rw-r--r--include/mbgl/style/expression/expression.hpp4
-rw-r--r--include/mbgl/style/layer.hpp2
-rw-r--r--include/mbgl/style/source.hpp5
-rw-r--r--include/mbgl/util/immutable.hpp4
-rw-r--r--src/mbgl/programs/fill_extrusion_program.cpp2
-rw-r--r--src/mbgl/style/layer.cpp2
7 files changed, 13 insertions, 8 deletions
diff --git a/include/mbgl/storage/offline.hpp b/include/mbgl/storage/offline.hpp
index f92a5d4cd3..9b21b528c2 100644
--- a/include/mbgl/storage/offline.hpp
+++ b/include/mbgl/storage/offline.hpp
@@ -36,7 +36,7 @@ public:
float pixelRatio_,
bool includeIdeographs_)
: OfflineRegionDefinition(std::move(styleURL_), minZoom_, maxZoom_, pixelRatio_, includeIdeographs_) {
- location = std::move(bounds_);
+ location = bounds_;
}
OfflineRegionDefinition(std::string styleURL_,
Geometry<double> geometry_,
diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp
index c747cd210d..ce4351ad98 100644
--- a/include/mbgl/style/expression/expression.hpp
+++ b/include/mbgl/style/expression/expression.hpp
@@ -176,8 +176,8 @@ enum class Kind : int32_t {
class Expression : public Serializable {
public:
Expression(Kind kind_, type::Type type_) : kind(kind_), type(std::move(type_)) {}
- virtual ~Expression() = default;
-
+ ~Expression() override = default;
+
virtual EvaluationResult evaluate(const EvaluationContext& params) const = 0;
virtual void eachChild(const std::function<void(const Expression&)>&) const = 0;
virtual bool operator==(const Expression&) const = 0;
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index f87a7c7fba..9d5ee4c1e6 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -88,7 +88,7 @@ public:
Layer(const Layer& ) = delete;
Layer& operator=(const Layer&) = delete;
- virtual ~Layer();
+ ~Layer() override;
std::string getID() const;
// Source
diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp
index 060bc0878c..f581fe4e78 100644
--- a/include/mbgl/style/source.hpp
+++ b/include/mbgl/style/source.hpp
@@ -75,7 +75,7 @@ public:
Source(const Source&) = delete;
Source& operator=(const Source&) = delete;
- virtual ~Source();
+ ~Source() override;
std::string getID() const;
optional<std::string> getAttribution() const;
@@ -93,6 +93,7 @@ public:
virtual void loadDescription(FileSource&) = 0;
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
virtual void setSourceData(SourceData) {}
/**
@@ -118,6 +119,8 @@ public:
* @return const GeoJSONData*
*/
virtual const GeoJSONData* getGeoJSONData() const { return nullptr; }
+
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
virtual void setSourceParameters(SourceParameters) {}
virtual void invalidateTile(const CanonicalTileID&) {}
diff --git a/include/mbgl/util/immutable.hpp b/include/mbgl/util/immutable.hpp
index 683af55c57..5d6f6dee25 100644
--- a/include/mbgl/util/immutable.hpp
+++ b/include/mbgl/util/immutable.hpp
@@ -45,8 +45,9 @@ private:
template <class S, class... Args> friend Mutable<S> makeMutable(Args&&...);
// NOLINTNEXTLINE(readability-redundant-declaration)
template <class S, class U> friend Mutable<S> staticMutableCast(const Mutable<U>&);
- // NOLINTNEXTLINE(readability-redundant-declaration)
+
template <class S, class U>
+ // NOLINTNEXTLINE(readability-redundant-declaration)
friend Mutable<S> constImmutableCast(const Immutable<U>&);
};
@@ -118,6 +119,7 @@ private:
template <class S, class U> friend Immutable<S> staticImmutableCast(const Immutable<U>&);
template <class S, class U>
+ // NOLINTNEXTLINE(readability-redundant-declaration)
friend Mutable<S> constImmutableCast(const Immutable<U>&);
};
diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp
index 7209072b02..eb8d58a6e5 100644
--- a/src/mbgl/programs/fill_extrusion_program.cpp
+++ b/src/mbgl/programs/fill_extrusion_program.cpp
@@ -12,7 +12,7 @@ using namespace style;
static_assert(sizeof(FillExtrusionLayoutVertex) == 12, "expected FillExtrusionLayoutVertex size");
std::array<float, 3> lightColor(const EvaluatedLight& light) {
- const auto color = light.get<LightColor>();
+ const auto& color = light.get<LightColor>();
return {{ color.r, color.g, color.b }};
}
diff --git a/src/mbgl/style/layer.cpp b/src/mbgl/style/layer.cpp
index da048ad2fa..cb8b16bc51 100644
--- a/src/mbgl/style/layer.cpp
+++ b/src/mbgl/style/layer.cpp
@@ -169,7 +169,7 @@ Value Layer::serialize() const {
mapbox::base::ValueObject result;
result.emplace(std::make_pair("id", getID()));
for (const auto& pair : layerProperties) {
- Property property = static_cast<Property>(pair.second);
+ auto property = static_cast<Property>(pair.second);
std::string key = pair.first.c_str();
auto styleProperty = getLayerProperty(this, property);
if (styleProperty != getLayerPropertyDefaultValue(property)) {