Standardize usage of virtual/override/final specifiers in base/.
The Google C++ style guide states:
Explicitly annotate overrides of virtual functions or virtual
destructors with an override or (less frequently) final specifier.
Older (pre-C++11) code will use the virtual keyword as an inferior
alternative annotation. For clarity, use exactly one of override,
final, or virtual when declaring an override.
To better conform to these guidelines, the following constructs have
been rewritten:
- if a base class has a virtual destructor, then:
virtual ~Foo(); -> ~Foo() override;
- virtual void Foo() override; -> void Foo() override;
- virtual void Foo() override final; -> void Foo() final;
This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.
Several formatting edits by clang-format were manually reverted, due to
mangling of some of the more complicate IPC macros.
BUG=417463
Review URL: https://codereview.chromium.org/804533005
Cr-Commit-Position: refs/heads/master@{#309527}
CrOS-Libchrome-Original-Commit: 8aef3761e6ff2a3315d23810187e5f52462db30f
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc
index 956faea..c162938 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -48,15 +48,7 @@
// file_util winds up using autoreleased objects on the Mac, so this needs
// to be a PlatformTest
-class FilePathTest : public PlatformTest {
- protected:
- virtual void SetUp() override {
- PlatformTest::SetUp();
- }
- virtual void TearDown() override {
- PlatformTest::TearDown();
- }
-};
+typedef PlatformTest FilePathTest;
TEST_F(FilePathTest, DirName) {
const struct UnaryTestData cases[] = {
diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc
index 0e19b2e..9081626 100644
--- a/base/files/file_path_watcher_browsertest.cc
+++ b/base/files/file_path_watcher_browsertest.cc
@@ -143,10 +143,10 @@
FilePathWatcherTest()
: file_thread_("FilePathWatcherTest") {}
- virtual ~FilePathWatcherTest() {}
+ ~FilePathWatcherTest() override {}
protected:
- virtual void SetUp() override {
+ void SetUp() override {
// Create a separate file thread in order to test proper thread usage.
base::Thread::Options options(MessageLoop::TYPE_IO, 0);
ASSERT_TRUE(file_thread_.StartWithOptions(options));
@@ -154,9 +154,7 @@
collector_ = new NotificationCollector();
}
- virtual void TearDown() override {
- RunLoop().RunUntilIdle();
- }
+ void TearDown() override { RunLoop().RunUntilIdle(); }
void DeleteDelegateOnFileThread(TestDelegate* delegate) {
file_thread_.message_loop_proxy()->DeleteSoon(FROM_HERE, delegate);
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc
index b5ed395..dbf1476 100644
--- a/base/files/file_proxy_unittest.cc
+++ b/base/files/file_proxy_unittest.cc
@@ -24,7 +24,7 @@
bytes_written_(-1),
weak_factory_(this) {}
- virtual void SetUp() override {
+ void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
ASSERT_TRUE(file_thread_.Start());
}
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index 87ae66a..17bbba8 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -23,7 +23,7 @@
bytes_written_(-1),
weak_factory_(this) {}
- virtual void SetUp() override {
+ void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
ASSERT_TRUE(file_thread_.Start());
}
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
index 29d5133..313ed03 100644
--- a/base/files/file_util_unittest.cc
+++ b/base/files/file_util_unittest.cc
@@ -184,7 +184,7 @@
// to be a PlatformTest
class FileUtilTest : public PlatformTest {
protected:
- virtual void SetUp() override {
+ void SetUp() override {
PlatformTest::SetUp();
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
}
@@ -2170,7 +2170,7 @@
// with a common SetUp() method.
class VerifyPathControlledByUserTest : public FileUtilTest {
protected:
- virtual void SetUp() override {
+ void SetUp() override {
FileUtilTest::SetUp();
// Create a basic structure used by each test.
diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc
index 96d0d05..98eaee8 100644
--- a/base/files/important_file_writer_unittest.cc
+++ b/base/files/important_file_writer_unittest.cc
@@ -82,7 +82,7 @@
class ImportantFileWriterTest : public testing::Test {
public:
ImportantFileWriterTest() { }
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
file_ = temp_dir_.path().AppendASCII("test-file");
}
diff --git a/base/files/memory_mapped_file_unittest.cc b/base/files/memory_mapped_file_unittest.cc
index 36999bf..d0833b5 100644
--- a/base/files/memory_mapped_file_unittest.cc
+++ b/base/files/memory_mapped_file_unittest.cc
@@ -29,12 +29,12 @@
class MemoryMappedFileTest : public PlatformTest {
protected:
- virtual void SetUp() override {
+ void SetUp() override {
PlatformTest::SetUp();
CreateTemporaryFile(&temp_file_path_);
}
- virtual void TearDown() { EXPECT_TRUE(DeleteFile(temp_file_path_, false)); }
+ void TearDown() override { EXPECT_TRUE(DeleteFile(temp_file_path_, false)); }
void CreateTemporaryTestFile(size_t size) {
File file(temp_file_path_,