summaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-09-03 10:32:21 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-09-03 10:32:21 +0000
commitfe4379e243ad90cb8720c5eb5aaba9c5a5dd6402 (patch)
tree23614c0a89a2e145e79b7f5706f9b1bd09dc6c2d /lib/Sema
parent406ef06ebca1d7267dab2e105867501caf2da2eb (diff)
downloadclang-fe4379e243ad90cb8720c5eb5aaba9c5a5dd6402.tar.gz
Added fixit notes for -Wfinal-dtor-non-final-class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index a5b4eda43c..e2f0aef7bf 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -6241,10 +6241,14 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
if (const CXXDestructorDecl *dtor = Record->getDestructor()) {
if (const FinalAttr *FA = dtor->getAttr<FinalAttr>()) {
Diag(FA->getLocation(), diag::warn_final_dtor_non_final_class)
- << FA->isSpelledAsSealed();
- Diag(Record->getLocation(), diag::note_final_dtor_non_final_class_silence)
- << Context.getRecordType(Record)
- << FA->isSpelledAsSealed();
+ << FA->isSpelledAsSealed()
+ << FixItHint::CreateRemoval(FA->getLocation())
+ << FixItHint::CreateInsertion(
+ getLocForEndOfToken(Record->getLocation()),
+ (FA->isSpelledAsSealed() ? " sealed" : " final"));
+ Diag(Record->getLocation(),
+ diag::note_final_dtor_non_final_class_silence)
+ << Context.getRecordType(Record) << FA->isSpelledAsSealed();
}
}
}