Skip to content

Commit 1cf2c8d

Browse files
johnstiles-googleSkia Commit-Bot
authored andcommitted
Enable ClangTidy flag modernize-use-override.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html Adds override (introduced in C++11) to overridden virtual functions and removes virtual from those functions as it is not required. virtual on non base class implementations was used to help indicate to the user that a function was virtual. C++ compilers did not use the presence of this to signify an overridden function. Change-Id: If66d8919358f72a4035190caf8d7569268037a9a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310160 Commit-Queue: Mike Klein <[email protected]> Auto-Submit: John Stiles <[email protected]> Reviewed-by: Mike Klein <[email protected]>
1 parent c184cf3 commit 1cf2c8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+88
-86
lines changed

.clang-tidy

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
Checks: '-*,bugprone-use-after-move,bugprone-unused-raii,bugprone-undelegated-constructor,bugprone-argument-comment,bugprone-bool-pointer-implicit-conversion,performance-unnecessary-copy-initialization,performance-for-range-copy,readability-redundant-preprocessor,misc-definitions-in-headers,modernize-make-unique,llvm-namespace-comment,readability-static-accessed-through-instance,readability-const-return-type,google-build-namespaces'
1+
Checks: >
2+
-*,
3+
bugprone-argument-comment,
4+
bugprone-bool-pointer-implicit-conversion,
5+
bugprone-undelegated-constructor,
6+
bugprone-unused-raii,
7+
bugprone-use-after-move,
8+
google-build-namespaces,
9+
llvm-namespace-comment,
10+
misc-definitions-in-headers,
11+
modernize-make-unique,
12+
modernize-use-override,
13+
performance-for-range-copy,
14+
performance-unnecessary-copy-initialization,
15+
readability-const-return-type,
16+
readability-redundant-preprocessor,
17+
readability-static-accessed-through-instance
218
CheckOptions:
319
- key: llvm-namespace-comment.SpacesBeforeComments
420
value: 2

bench/DashBench.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ class RectDashBench : public DashBench {
104104
}
105105

106106
protected:
107-
virtual void handlePath(SkCanvas* canvas, const SkPath& path,
108-
const SkPaint& paint, int N) override {
107+
void handlePath(SkCanvas* canvas, const SkPath& path, const SkPaint& paint, int N) override {
109108
SkPoint pts[2];
110109
if (!path.isLine(pts) || pts[0].fY != pts[1].fY) {
111110
this->INHERITED::handlePath(canvas, path, paint, N);

bench/PathBench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class RotatedRectBench : public PathBench {
129129
path->transform(rotateMatrix);
130130
}
131131

132-
virtual void setupPaint(SkPaint* paint) override {
132+
void setupPaint(SkPaint* paint) override {
133133
PathBench::setupPaint(paint);
134134
paint->setAntiAlias(fAA);
135135
}

gm/croppedrects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ constexpr SkRect kSrcImageClip{75, 75, 275, 275};
3535
*/
3636
class CroppedRectsGM : public GM {
3737
private:
38-
SkString onShortName() override final { return SkString("croppedrects"); }
38+
SkString onShortName() final { return SkString("croppedrects"); }
3939
SkISize onISize() override { return SkISize::Make(500, 500); }
4040

4141
void onOnceBeforeDraw() override {

gm/cubicpaths.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ClippedCubicGM : public skiagm::GM {
2929

3030
SkISize onISize() override { return {1240, 390}; }
3131

32-
virtual void onDraw(SkCanvas* canvas) override {
32+
void onDraw(SkCanvas* canvas) override {
3333
SkPath path;
3434
path.moveTo(0, 0);
3535
path.cubicTo(140, 150, 40, 10, 170, 150);
@@ -259,7 +259,7 @@ class CubicClosePathGM : public skiagm::GM {
259259
canvas->restore();
260260
}
261261

262-
virtual void onDraw(SkCanvas* canvas) override {
262+
void onDraw(SkCanvas* canvas) override {
263263
struct FillAndName {
264264
SkPathFillType fFill;
265265
const char* fName;

gm/dftext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DFTextGM : public skiagm::GM {
5252
return SkISize::Make(1024, 768);
5353
}
5454

55-
virtual void onDraw(SkCanvas* inputCanvas) override {
55+
void onDraw(SkCanvas* inputCanvas) override {
5656
SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
5757
SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
5858

gm/hairmodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace skiagm {
8888
return SkString("hairmodes");
8989
}
9090

91-
virtual SkISize onISize() override { return SkISize::Make(640, 480); }
91+
SkISize onISize() override { return SkISize::Make(640, 480); }
9292

9393
void onOnceBeforeDraw() override {
9494
fBGPaint.setShader(make_bg_shader());

gm/shapes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ShapesGM : public GM {
3636
}
3737
}
3838

39-
SkString onShortName() override final { return fName; }
39+
SkString onShortName() final { return fName; }
4040
SkISize onISize() override { return SkISize::Make(500, 500); }
4141

4242
void onOnceBeforeDraw() override {

gm/tinybitmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TinyBitmapGM : public skiagm::GM {
2121

2222
SkString onShortName() override { return SkString("tinybitmap"); }
2323

24-
virtual SkISize onISize() override { return SkISize::Make(100, 100); }
24+
SkISize onISize() override { return SkISize::Make(100, 100); }
2525

2626
void onDraw(SkCanvas* canvas) override {
2727
SkBitmap bm;

include/utils/SkLuaCanvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SkLuaCanvas : public SkCanvas {
3333
void didTranslate(SkScalar, SkScalar) override;
3434

3535
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
36-
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
36+
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
3737
const SkPaint& paint) override;
3838

3939
void onDrawPaint(const SkPaint&) override;

0 commit comments

Comments
 (0)