Use 'final' specifier on leaf classes

Tint makes heavy use of RTTI via virtual methods. Give the compiler the
opportunity to optimize away some of these virtuals.

Bug: tint:1383
Change-Id: I28edfaa0a05bb1a9c506c61c0084542c0aeb37f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82745
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-03-07 18:37:46 +00:00
committed by Tint LUCI CQ
parent dc0e31cfaa
commit 41f8d2ad52
119 changed files with 174 additions and 159 deletions

View File

@@ -47,13 +47,13 @@ namespace {
using ResolverValidationTest = ResolverTest;
class FakeStmt : public Castable<FakeStmt, ast::Statement> {
class FakeStmt final : public Castable<FakeStmt, ast::Statement> {
public:
FakeStmt(ProgramID pid, Source src) : Base(pid, src) {}
FakeStmt* Clone(CloneContext*) const override { return nullptr; }
};
class FakeExpr : public Castable<FakeExpr, ast::Expression> {
class FakeExpr final : public Castable<FakeExpr, ast::Expression> {
public:
FakeExpr(ProgramID pid, Source src) : Base(pid, src) {}
FakeExpr* Clone(CloneContext*) const override { return nullptr; }