summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-09-13 13:09:01 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-09-13 13:19:22 +0200
commit91dd2db17bd6cb9b357d1d69b187174e31eabef0 (patch)
treed634de3a1a6820904b5699c2136b79b1a5a807c7 /compilerplugins
parent6f8ea7e89ea190b9462c945d55a3ad8777b2f3ef (diff)
loplugin:override: No more need for the "MSVC dtor override" workaround
The issue of 362d4f0cd4e50111edfae9d30c90602c37ed65a2 "Explicitly mark overriding destructors as 'virtual'" appears to no longer be a problem with MSVC 2013. (The little change in the rewriting code of compilerplugins/clang/override.cxx was necessary to prevent an endless loop when adding "override" to OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); in chart2/source/inc/LifeTime.hxx, getting stuck in the leading OOO_DLLPUBLIC_CHARTTOOLS macro. Can't remember what that isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.) Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/override.cxx21
1 files changed, 2 insertions, 19 deletions
diff --git a/compilerplugins/clang/override.cxx b/compilerplugins/clang/override.cxx
index a350415e36d6..412846c5b521 100644
--- a/compilerplugins/clang/override.cxx
+++ b/compilerplugins/clang/override.cxx
@@ -54,24 +54,6 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) {
{
return true;
}
- // It appears that the C++ standard allows overriding destructors to be
- // marked "override," but at least some MSVC versions complain about it, so
- // at least make sure such destructors are explicitly marked "virtual":
- if (isa<CXXDestructorDecl>(decl)) {
- if (!decl->isVirtualAsWritten()
- && (rewriter == nullptr
- || !insertTextBefore(
- decl->getSourceRange().getBegin(), "virtual ")))
- {
- report(
- DiagnosticsEngine::Warning,
- ("overriding destructor declaration not explicitly marked"
- " 'override'"),
- decl->getLocation())
- << decl->getSourceRange();
- }
- return true;
- }
std::string over(
isInUnoIncludeFile(decl->getSourceRange().getBegin())
? "SAL_OVERRIDE" : "override");
@@ -148,7 +130,8 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) {
l, &l))
{
n = Lexer::MeasureTokenLength(
- l, compiler.getSourceManager(), compiler.getLangOpts());
+ compiler.getSourceManager().getSpellingLoc(l),
+ compiler.getSourceManager(), compiler.getLangOpts());
}
l = l.getLocWithOffset(std::max<unsigned>(n, 1));
}