diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-04-11 02:00:23 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-04-11 02:00:23 +0000 |
commit | dfa4cf312655e1a82a39b0ef94e2a4db731aedad (patch) | |
tree | 380384533a5cedc86ff5bf81b7cc334777369102 /lib/ASTMatchers | |
parent | 7d191b2364ab007773cdb792dbd64d1f92158618 (diff) | |
download | clang-dfa4cf312655e1a82a39b0ef94e2a4db731aedad.tar.gz |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ASTMatchers')
-rw-r--r-- | lib/ASTMatchers/ASTMatchFinder.cpp | 2 | ||||
-rw-r--r-- | lib/ASTMatchers/Dynamic/Marshallers.h | 53 |
2 files changed, 30 insertions, 25 deletions
diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index fa7968a805..c5f3063fb4 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -300,7 +300,7 @@ public: const MatchFinder::MatchFinderOptions &Options) : Matchers(Matchers), Options(Options), ActiveASTContext(nullptr) {} - ~MatchASTVisitor() { + ~MatchASTVisitor() override { if (Options.CheckProfiling) { Options.CheckProfiling->Records = std::move(TimeByBucket); } diff --git a/lib/ASTMatchers/Dynamic/Marshallers.h b/lib/ASTMatchers/Dynamic/Marshallers.h index b78bc03819..36a6415ae8 100644 --- a/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/lib/ASTMatchers/Dynamic/Marshallers.h @@ -181,18 +181,20 @@ public: ArgKinds(ArgKinds.begin(), ArgKinds.end()) {} VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, Diagnostics *Error) const { + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { return Marshaller(Func, MatcherName, NameRange, Args, Error); } - bool isVariadic() const { return false; } - unsigned getNumArgs() const { return ArgKinds.size(); } + bool isVariadic() const override { return false; } + unsigned getNumArgs() const override { return ArgKinds.size(); } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector<ArgKind> &Kinds) const { + std::vector<ArgKind> &Kinds) const override { Kinds.push_back(ArgKinds[ArgNo]); } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { return isRetKindConvertibleTo(RetKinds, Kind, Specificity, LeastDerivedKind); } @@ -333,18 +335,20 @@ public: } VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, Diagnostics *Error) const { + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { return Func(MatcherName, NameRange, Args, Error); } - bool isVariadic() const { return true; } - unsigned getNumArgs() const { return 0; } + bool isVariadic() const override { return true; } + unsigned getNumArgs() const override { return 0; } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector<ArgKind> &Kinds) const { + std::vector<ArgKind> &Kinds) const override { Kinds.push_back(ArgsKind); } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { return isRetKindConvertibleTo(RetKinds, Kind, Specificity, LeastDerivedKind); } @@ -487,11 +491,11 @@ public: OverloadedMatcherDescriptor(ArrayRef<MatcherDescriptor *> Callbacks) : Overloads(Callbacks.begin(), Callbacks.end()) {} - virtual ~OverloadedMatcherDescriptor() {} + ~OverloadedMatcherDescriptor() override {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, - Diagnostics *Error) const { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { std::vector<VariantMatcher> Constructed; Diagnostics::OverloadContext Ctx(Error); for (const auto &O : Overloads) { @@ -512,7 +516,7 @@ public: return Constructed[0]; } - bool isVariadic() const { + bool isVariadic() const override { bool Overload0Variadic = Overloads[0]->isVariadic(); #ifndef NDEBUG for (const auto &O : Overloads) { @@ -522,7 +526,7 @@ public: return Overload0Variadic; } - unsigned getNumArgs() const { + unsigned getNumArgs() const override { unsigned Overload0NumArgs = Overloads[0]->getNumArgs(); #ifndef NDEBUG for (const auto &O : Overloads) { @@ -533,15 +537,16 @@ public: } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector<ArgKind> &Kinds) const { + std::vector<ArgKind> &Kinds) const override { for (const auto &O : Overloads) { if (O->isConvertibleTo(ThisKind)) O->getArgKinds(ThisKind, ArgNo, Kinds); } } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { for (const auto &O : Overloads) { if (O->isConvertibleTo(Kind, Specificity, LeastDerivedKind)) return true; @@ -562,9 +567,9 @@ public: : MinCount(MinCount), MaxCount(MaxCount), Op(Op), MatcherName(MatcherName) {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, - Diagnostics *Error) const override { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { if (Args.size() < MinCount || MaxCount < Args.size()) { const std::string MaxStr = (MaxCount == UINT_MAX ? "" : Twine(MaxCount)).str(); |