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 <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index b010e88..e33e130 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -1217,8 +1217,8 @@
fLastY = y + height - 1;
}
- virtual void blitAntiRect(int x, int y, int width, int height,
- SkAlpha leftAlpha, SkAlpha rightAlpha) override {
+ void blitAntiRect(int x, int y, int width, int height,
+ SkAlpha leftAlpha, SkAlpha rightAlpha) override {
this->recordMinY(y);
this->checkForYGap(y);
fBuilder->addAntiRectRun(x, y, width, height, leftAlpha, rightAlpha);
@@ -1238,8 +1238,8 @@
fBuilder->addRun(x, y, 0xFF, width);
}
- virtual void blitAntiH(int x, int y, const SkAlpha alpha[],
- const int16_t runs[]) override {
+ void blitAntiH(int x, int y, const SkAlpha alpha[],
+ const int16_t runs[]) override {
this->recordMinY(y);
this->checkForYGap(y);
for (;;) {
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index 4f050a9..46150db 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -189,8 +189,8 @@
void blitAntiH(int x, int y, const SkAlpha[], const int16_t runs[]) override;
void blitV(int x, int y, int height, SkAlpha alpha) override;
void blitRect(int x, int y, int width, int height) override;
- virtual void blitAntiRect(int x, int y, int width, int height,
- SkAlpha leftAlpha, SkAlpha rightAlpha) override;
+ void blitAntiRect(int x, int y, int width, int height,
+ SkAlpha leftAlpha, SkAlpha rightAlpha) override;
void blitMask(const SkMask&, const SkIRect& clip) override;
const SkPixmap* justAnOpaqueColor(uint32_t* value) override;
diff --git a/src/core/SkExecutor.cpp b/src/core/SkExecutor.cpp
index f4aa65c..6ed366f 100644
--- a/src/core/SkExecutor.cpp
+++ b/src/core/SkExecutor.cpp
@@ -89,7 +89,7 @@
}
}
- virtual void add(std::function<void(void)> work) override {
+ void add(std::function<void(void)> work) override {
// Add some work to our pile of work to do.
{
SkAutoMutexExclusive lock(fWorkLock);
@@ -99,7 +99,7 @@
fWorkAvailable.signal(1);
}
- virtual void borrow() override {
+ void borrow() override {
// If there is work waiting and we're allowed to borrow work, do it.
if (fAllowBorrowing && fWorkAvailable.try_wait()) {
SkAssertResult(this->do_work());
diff --git a/src/core/SkPtrRecorder.h b/src/core/SkPtrRecorder.h
index 389751d..1f94105 100644
--- a/src/core/SkPtrRecorder.h
+++ b/src/core/SkPtrRecorder.h
@@ -131,8 +131,8 @@
protected:
// overrides
- virtual void incPtr(void*) override ;
- virtual void decPtr(void*) override ;
+ void incPtr(void*) override;
+ void decPtr(void*) override;
};
class SkFactorySet : public SkTPtrSet<SkFlattenable::Factory> {};
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index be5d19f..82d4304 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -44,8 +44,7 @@
const SkIRect& clipBounds, bool isInverse);
/// Must be explicitly defined on subclasses.
- virtual void blitAntiH(int x, int y, const SkAlpha antialias[],
- const int16_t runs[]) override {
+ void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override {
SkDEBUGFAIL("How did I get here?");
}
/// May not be called on BaseSuperBlitter because it blits out of order.
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 2d606fb..02ad8b7 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -135,8 +135,7 @@
return fy - SK_Fixed1/2;
}
- virtual SkFixed drawLine(int x, int stopx, SkFixed fy,
- SkFixed slope) override {
+ SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed slope) override {
SkASSERT(x < stopx);
int count = stopx - x;
fy += SK_Fixed1/2;
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index b33a0d4..dae4f7e 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -43,8 +43,8 @@
SkRect computeFastBounds(const SkRect& src) const override;
- virtual SkIRect onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- MapDirection, const SkIRect* inputRect) const override;
+ SkIRect onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
+ MapDirection, const SkIRect* inputRect) const override;
SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix& ctm,
MapDirection, const SkIRect* inputRect) const override;
diff --git a/src/gpu/GrPathProcessor.h b/src/gpu/GrPathProcessor.h
index aeb9252..179af1c 100644
--- a/src/gpu/GrPathProcessor.h
+++ b/src/gpu/GrPathProcessor.h
@@ -28,12 +28,11 @@
const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
- virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
- GrProcessorKeyBuilder* b) const override;
+ void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
- virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
- virtual bool isPathRendering() const override { return true; }
+ bool isPathRendering() const override { return true; }
private:
GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index bfff3d5..f1cd107 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -150,7 +150,7 @@
public:
GLCircularRRectEffect() = default;
- virtual void emitCode(EmitArgs&) override;
+ void emitCode(EmitArgs&) override;
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index b84dac7..225c8ad 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -52,7 +52,7 @@
sk_sp<SkImage> onReinterpretColorSpace(sk_sp<SkColorSpace>) const final;
- virtual bool isYUVA() const override { return true; }
+ bool isYUVA() const override { return true; }
bool setupMipmapsForPlanes(GrRecordingContext*) const;
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 0931fbf..8a2ebd8 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -82,7 +82,7 @@
return SkStream::MakeFromFile(fPathName.c_str());
}
- virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const override {
+ void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const override {
SkASSERT(desc);
SkASSERT(serialize);
desc->setFamilyName(fFamilyName.c_str());
@@ -134,8 +134,7 @@
, fData(std::move(data))
{ }
- virtual void onGetFontDescriptor(SkFontDescriptor* desc,
- bool* serialize) const override {
+ void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const override {
SkASSERT(desc);
SkASSERT(serialize);
desc->setFamilyName(fFamilyName.c_str());
@@ -353,14 +352,14 @@
return nullptr;
}
- virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
- const SkFontStyle& style) const override {
+ SkTypeface* onMatchFamilyStyle(const char familyName[],
+ const SkFontStyle& style) const override {
sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName));
return sset->matchStyle(style);
}
- virtual SkTypeface* onMatchFaceStyle(const SkTypeface* typeface,
- const SkFontStyle& style) const override {
+ SkTypeface* onMatchFaceStyle(const SkTypeface* typeface,
+ const SkFontStyle& style) const override {
for (int i = 0; i < fStyleSets.count(); ++i) {
for (int j = 0; j < fStyleSets[i]->fStyles.count(); ++j) {
if (fStyleSets[i]->fStyles[j].get() == typeface) {
@@ -403,12 +402,11 @@
return nullptr;
}
- virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
- const SkFontStyle& style,
- const char* bcp47[],
- int bcp47Count,
- SkUnichar character) const override
- {
+ SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
+ const SkFontStyle& style,
+ const char* bcp47[],
+ int bcp47Count,
+ SkUnichar character) const override {
// The variant 'elegant' is 'not squashed', 'compact' is 'stays in ascent/descent'.
// The variant 'default' means 'compact and elegant'.
// As a result, it is not possible to know the variant context from the font alone.
diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp
index c16d99f..098f781 100644
--- a/src/shaders/SkPerlinNoiseShader.cpp
+++ b/src/shaders/SkPerlinNoiseShader.cpp
@@ -760,8 +760,7 @@
return new GrGLPerlinNoise;
}
- virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps,
- GrProcessorKeyBuilder* b) const override {
+ void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
GrGLPerlinNoise::GenKey(*this, caps, b);
}
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 663a13e..9436e02 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -1589,18 +1589,18 @@
, fType(type)
, fPrecision(precision) {}
- virtual SpvId getPointer() override {
+ SpvId getPointer() override {
return fPointer;
}
- virtual SpvId load(OutputStream& out) override {
+ SpvId load(OutputStream& out) override {
SpvId result = fGen.nextId();
fGen.writeInstruction(SpvOpLoad, fType, result, fPointer, out);
fGen.writePrecisionModifier(fPrecision, result);
return result;
}
- virtual void store(SpvId value, OutputStream& out) override {
+ void store(SpvId value, OutputStream& out) override {
fGen.writeInstruction(SpvOpStore, fPointer, value, out);
}
@@ -1623,11 +1623,11 @@
, fSwizzleType(swizzleType)
, fPrecision(precision) {}
- virtual SpvId getPointer() override {
+ SpvId getPointer() override {
return 0;
}
- virtual SpvId load(OutputStream& out) override {
+ SpvId load(OutputStream& out) override {
SpvId base = fGen.nextId();
fGen.writeInstruction(SpvOpLoad, fGen.getType(fBaseType), base, fVecPointer, out);
fGen.writePrecisionModifier(fPrecision, base);
@@ -1644,7 +1644,7 @@
return result;
}
- virtual void store(SpvId value, OutputStream& out) override {
+ void store(SpvId value, OutputStream& out) override {
// use OpVectorShuffle to mix and match the vector components. We effectively create
// a virtual vector out of the concatenation of the left and right vectors, and then
// select components from this virtual vector to make the result vector. For
diff --git a/src/sksl/ir/SkSLField.h b/src/sksl/ir/SkSLField.h
index d187a80..3dfc87e 100644
--- a/src/sksl/ir/SkSLField.h
+++ b/src/sksl/ir/SkSLField.h
@@ -27,7 +27,7 @@
, fOwner(owner)
, fFieldIndex(fieldIndex) {}
- virtual String description() const override {
+ String description() const override {
return fOwner.description() + "." + fOwner.fType.fields()[fFieldIndex].fName;
}
diff --git a/src/sksl/ir/SkSLNop.h b/src/sksl/ir/SkSLNop.h
index 8316dc3..da2462e 100644
--- a/src/sksl/ir/SkSLNop.h
+++ b/src/sksl/ir/SkSLNop.h
@@ -20,7 +20,7 @@
Nop()
: INHERITED(-1, kNop_Kind) {}
- virtual bool isEmpty() const override {
+ bool isEmpty() const override {
return true;
}
diff --git a/src/sksl/ir/SkSLSymbol.h b/src/sksl/ir/SkSLSymbol.h
index f7e4222..b0ae69b 100644
--- a/src/sksl/ir/SkSLSymbol.h
+++ b/src/sksl/ir/SkSLSymbol.h
@@ -30,7 +30,7 @@
, fKind(kind)
, fName(name) {}
- virtual ~Symbol() override {}
+ ~Symbol() override {}
Kind fKind;
StringFragment fName;
diff --git a/src/sksl/ir/SkSLVariable.h b/src/sksl/ir/SkSLVariable.h
index a835518..7fff387 100644
--- a/src/sksl/ir/SkSLVariable.h
+++ b/src/sksl/ir/SkSLVariable.h
@@ -48,7 +48,7 @@
SkASSERT(!fReadCount && !fWriteCount);
}
- virtual String description() const override {
+ String description() const override {
return fModifiers.description() + fType.fName + " " + fName;
}