Skip to content

Commit 2278af6

Browse files
authored
Merge pull request #2166 from hzeller/feature-20240419-only-use-override-where-needed
Prefer 'final', only use 'override' where needed.
2 parents ec69cae + a08a205 commit 2278af6

11 files changed

+19
-17
lines changed

common/analysis/line_lint_rule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace verible {
2626

2727
class LineLintRule : public LintRule {
2828
public:
29-
~LineLintRule() override = default;
29+
~LineLintRule() override = default; // not yet final
3030

3131
// Scans a single line during analysis.
3232
virtual void HandleLine(absl::string_view line) = 0;

common/analysis/syntax_tree_lint_rule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace verible {
3838
// top of the stack/back of vector.
3939
class SyntaxTreeLintRule : public LintRule {
4040
public:
41-
~SyntaxTreeLintRule() override = default;
41+
~SyntaxTreeLintRule() override = default; // not yet final
4242

4343
virtual void HandleLeaf(const SyntaxTreeLeaf &leaf,
4444
const SyntaxTreeContext &context) {}

common/analysis/text_structure_lint_rule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace verible {
3838

3939
class TextStructureLintRule : public LintRule {
4040
public:
41-
~TextStructureLintRule() override = default;
41+
~TextStructureLintRule() override = default; // not yet final
4242

4343
// Analyze text structure for violations.
4444
virtual void Lint(const TextStructureView &text_structure,

common/analysis/token_stream_lint_rule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace verible {
2626

2727
class TokenStreamLintRule : public LintRule {
2828
public:
29-
~TokenStreamLintRule() override = default;
29+
~TokenStreamLintRule() override = default; // not yet final
3030

3131
// Scans a single token during analysis.
3232
virtual void HandleToken(const TokenInfo &token) = 0;

common/analysis/violation_handler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ViolationPrinter : public ViolationHandler {
5151

5252
void HandleViolations(
5353
const std::set<verible::LintViolationWithStatus>& violations,
54-
absl::string_view base, absl::string_view path) override;
54+
absl::string_view base, absl::string_view path) final;
5555

5656
protected:
5757
std::ostream* const stream_;
@@ -68,7 +68,7 @@ class ViolationWaiverPrinter : public ViolationHandler {
6868

6969
void HandleViolations(
7070
const std::set<verible::LintViolationWithStatus>& violations,
71-
absl::string_view base, absl::string_view path) override;
71+
absl::string_view base, absl::string_view path) final;
7272

7373
protected:
7474
std::ostream* const message_stream_;

common/formatting/tree_unwrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TreeUnwrapper : public TreeContextVisitor {
5252
TreeUnwrapper& operator=(const TreeUnwrapper&) = delete;
5353
TreeUnwrapper& operator=(TreeUnwrapper&&) = delete;
5454

55-
~TreeUnwrapper() override = default;
55+
~TreeUnwrapper() override = default; // not yet final.
5656

5757
// Partitions the token stream (in text_structure_view_) into
5858
// unwrapped_lines_ by traversing the syntax tree representation.

common/lexer/flex_lexer_adapter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class FlexLexerAdapter : private CodeStreamHolder, protected L, public Lexer {
7777
const TokenInfo &GetLastToken() const final { return last_token_; }
7878

7979
// Returns next token and updates its location.
80-
const TokenInfo &DoNextToken() override {
80+
const TokenInfo &DoNextToken() override { // not yet final
8181
if (at_eof_) {
8282
// Do not call yylex(), because that will result in the fatal error:
8383
// "fatal flex scanner internal error--end of buffer missed"
@@ -108,7 +108,7 @@ class FlexLexerAdapter : private CodeStreamHolder, protected L, public Lexer {
108108
}
109109

110110
// Restart lexer by pointing to new input stream, and reset all state.
111-
void Restart(absl::string_view code) override {
111+
void Restart(absl::string_view code) override { // not yet final
112112
at_eof_ = false;
113113
code_ = code;
114114
code_stream_.str(std::string(code_));

common/lexer/token_stream_adapter_test.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class FakeTokenSequenceLexer : public Lexer, public FakeLexer {
3838

3939
void Restart(absl::string_view) final {}
4040

41-
bool TokenIsError(const TokenInfo &) const override { return false; }
41+
bool TokenIsError(const TokenInfo &) const override { // not yet final.
42+
return false;
43+
}
4244
};
4345

4446
TEST(MakeTokenGeneratorTest, Generate) {

common/text/text_structure_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class TextStructureViewInternalsTest : public TextStructureViewPublicTest {
363363
// modifications. This is only appropriate for tests on private or protected
364364
// methods; public methods should always leave the structure in a consistent
365365
// state.
366-
~TextStructureViewInternalsTest() override { Clear(); }
366+
~TextStructureViewInternalsTest() override { Clear(); } // not yet final
367367
};
368368

369369
// Test that whole tree is returned with offset 0.

common/text/tree_context_visitor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class TreeContextVisitor : public SymbolVisitor {
3030
TreeContextVisitor() = default;
3131

3232
protected:
33-
void Visit(const SyntaxTreeLeaf &leaf) override {}
34-
void Visit(const SyntaxTreeNode &node) override;
33+
void Visit(const SyntaxTreeLeaf &leaf) override {} // not yet final
34+
void Visit(const SyntaxTreeNode &node) override; // not yet final
3535

3636
const SyntaxTreeContext &Context() const { return current_context_; }
3737

verilog/tools/ls/verilog-language-server_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class VerilogLanguageServerTest : public ::testing::Test {
123123
// Sets up the testing environment - creates Language Server object and
124124
// sends textDocument/initialize request.
125125
// It stores the response in initialize_response field for further processing
126-
void SetUp() override {
126+
void SetUp() override { // not yet final
127127
server_ = std::make_unique<VerilogLanguageServer>(
128128
[this](absl::string_view response) { response_stream_ << response; });
129129

@@ -148,7 +148,7 @@ class VerilogLanguageServerTest : public ::testing::Test {
148148

149149
class VerilogLanguageServerSymbolTableTest : public VerilogLanguageServerTest {
150150
public:
151-
absl::Status InitializeCommunication() override {
151+
absl::Status InitializeCommunication() final {
152152
json initialize_request = {
153153
{"jsonrpc", "2.0"},
154154
{"id", 1},
@@ -158,7 +158,7 @@ class VerilogLanguageServerSymbolTableTest : public VerilogLanguageServerTest {
158158
}
159159

160160
protected:
161-
void SetUp() override {
161+
void SetUp() final {
162162
absl::SetFlag(&FLAGS_rules_config_search, true);
163163
root_dir = verible::file::JoinPath(
164164
::testing::TempDir(),
@@ -168,7 +168,7 @@ class VerilogLanguageServerSymbolTableTest : public VerilogLanguageServerTest {
168168
VerilogLanguageServerTest::SetUp();
169169
}
170170

171-
void TearDown() override { std::filesystem::remove(root_dir); }
171+
void TearDown() final { std::filesystem::remove(root_dir); }
172172

173173
// path to the project
174174
std::string root_dir;

0 commit comments

Comments
 (0)