Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.
This command was used:
tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
-checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D8926
llvm-svn: 234678
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 7edec96..4b0580a 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -747,12 +747,12 @@
Name.clear();
}
- ~VerifyIdIsBoundTo() {
+ ~VerifyIdIsBoundTo() override {
EXPECT_EQ(0, Count);
EXPECT_EQ("", Name);
}
- virtual bool run(const BoundNodes *Nodes) override {
+ bool run(const BoundNodes *Nodes) override {
const BoundNodes::IDToNodeMap &M = Nodes->getMap();
if (Nodes->getNodeAs<T>(Id)) {
++Count;
@@ -774,7 +774,7 @@
return false;
}
- virtual bool run(const BoundNodes *Nodes, ASTContext *Context) override {
+ bool run(const BoundNodes *Nodes, ASTContext *Context) override {
return run(Nodes);
}
@@ -4379,9 +4379,9 @@
: Id(Id), InnerMatcher(InnerMatcher), InnerId(InnerId) {
}
- virtual bool run(const BoundNodes *Nodes) { return false; }
+ bool run(const BoundNodes *Nodes) override { return false; }
- virtual bool run(const BoundNodes *Nodes, ASTContext *Context) {
+ bool run(const BoundNodes *Nodes, ASTContext *Context) override {
const T *Node = Nodes->getNodeAs<T>(Id);
return selectFirst<T>(InnerId, match(InnerMatcher, *Node, *Context)) !=
nullptr;
@@ -4430,9 +4430,9 @@
template <typename T>
class VerifyAncestorHasChildIsEqual : public BoundNodesCallback {
public:
- virtual bool run(const BoundNodes *Nodes) { return false; }
+ bool run(const BoundNodes *Nodes) override { return false; }
- virtual bool run(const BoundNodes *Nodes, ASTContext *Context) {
+ bool run(const BoundNodes *Nodes, ASTContext *Context) override {
const T *Node = Nodes->getNodeAs<T>("");
return verify(*Nodes, *Context, Node);
}
@@ -4488,12 +4488,10 @@
class VerifyStartOfTranslationUnit : public MatchFinder::MatchCallback {
public:
VerifyStartOfTranslationUnit() : Called(false) {}
- virtual void run(const MatchFinder::MatchResult &Result) {
+ void run(const MatchFinder::MatchResult &Result) override {
EXPECT_TRUE(Called);
}
- virtual void onStartOfTranslationUnit() {
- Called = true;
- }
+ void onStartOfTranslationUnit() override { Called = true; }
bool Called;
};
@@ -4516,12 +4514,10 @@
class VerifyEndOfTranslationUnit : public MatchFinder::MatchCallback {
public:
VerifyEndOfTranslationUnit() : Called(false) {}
- virtual void run(const MatchFinder::MatchResult &Result) {
+ void run(const MatchFinder::MatchResult &Result) override {
EXPECT_FALSE(Called);
}
- virtual void onEndOfTranslationUnit() {
- Called = true;
- }
+ void onEndOfTranslationUnit() override { Called = true; }
bool Called;
};