clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions
This check enforces guidelines related to explicitly specifying
override or final when overriding virtual functions in C++
classes.
Change-Id: I5c7de19e9f7521f4b8a947a25540a44c400da104
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index 086b9aa..d1f674c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -198,6 +198,7 @@
cppcoreguidelines-avoid-goto,
cppcoreguidelines-avoid-non-const-global-variables,
cppcoreguidelines-c-copy-assignment-signature,
+cppcoreguidelines-explicit-virtual-functions,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-no-malloc,
cppcoreguidelines-prefer-member-initializer,
diff --git a/activation.hpp b/activation.hpp
index 8552e88..2a83569 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -135,7 +135,7 @@
enableRebootGuard();
}
- ~ActivationBlocksTransition()
+ ~ActivationBlocksTransition() override
{
disableRebootGuard();
}
diff --git a/test/utest.cpp b/test/utest.cpp
index 8f400ff..831d9b3 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -24,7 +24,7 @@
class VersionTest : public testing::Test
{
protected:
- virtual void SetUp()
+ void SetUp() override
{
char versionDir[] = "./versionXXXXXX";
_directory = mkdtemp(versionDir);
@@ -35,7 +35,7 @@
}
}
- virtual void TearDown()
+ void TearDown() override
{
fs::remove_all(_directory);
}
@@ -183,7 +183,7 @@
std::cout << "COMMAND Error: " << val << std::endl;
}
}
- virtual void SetUp()
+ void SetUp() override
{
// Create test base directory.
fs::create_directories(testPath);
@@ -269,7 +269,7 @@
signature = std::make_unique<Signature>(extractPath, signedConfPath);
}
- virtual void TearDown()
+ void TearDown() override
{
command("rm -rf " + std::string(testPath));
}
@@ -378,7 +378,7 @@
}
}
- virtual void SetUp()
+ void SetUp() override
{
// Create test base directory.
tmpDir = fs::temp_directory_path() / "testFileXXXXXX";
@@ -396,7 +396,7 @@
srcFiles.push_back(file2);
}
- virtual void TearDown()
+ void TearDown() override
{
fs::remove_all(tmpDir);
}