summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UseOverride.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UseOverride.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/UseOverride.cpp b/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
index 628c20f4a22..b2dc912b44c 100644
--- a/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
@@ -65,8 +65,9 @@ void UseOverride::check(const MatchFinder::MatchResult &Result) {
!Method->isVirtualAsWritten())
return; // Nothing to do.
- DiagnosticBuilder Diag = diag(Method->getLocation(),
- "Prefer using 'override' instead of 'virtual'");
+ DiagnosticBuilder Diag =
+ diag(Method->getLocation(),
+ "Prefer using 'override' or 'final' instead of 'virtual'");
CharSourceRange FileRange =
Lexer::makeFileCharRange(CharSourceRange::getTokenRange(
@@ -83,7 +84,8 @@ void UseOverride::check(const MatchFinder::MatchResult &Result) {
Result.Context->getLangOpts());
// Add 'override' on inline declarations that don't already have it.
- if (Method->getAttr<clang::OverrideAttr>() == nullptr) {
+ if (Method->getAttr<clang::OverrideAttr>() == nullptr &&
+ Method->getAttr<clang::FinalAttr>() == nullptr) {
SourceLocation InsertLoc;
StringRef ReplacementText = "override ";
OpenPOWER on IntegriCloud