diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-01-27 10:47:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-27 10:47:16 +0100 |
commit | 1a90a23d9fdcc4344f459b183bbafb8ba7b5bcc0 (patch) | |
tree | ae34304edb049e6d2c880cee910ac98dc25b0a14 /compilerplugins | |
parent | 38da1ed9195578aed4edb9d3c9c9eb2587923658 (diff) |
Enable loplugin:dynexcspec rewriting mode
Change-Id: I73404287c387a36e224683f75e967d51d911175b
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/dynexcspec.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/compilerplugins/clang/dynexcspec.cxx b/compilerplugins/clang/dynexcspec.cxx index b06245e0ff03..b5db5df894a2 100644 --- a/compilerplugins/clang/dynexcspec.cxx +++ b/compilerplugins/clang/dynexcspec.cxx @@ -58,9 +58,23 @@ public: " no corresponding documentation comment"), decl->getLocation()) << decl->getSourceRange(); - return true; } -#if 0 // will be enabled later + if (rewriter != nullptr) { + if (!(decl->isDefined() || decl->isPure())) { + return true; + } + if (auto m = dyn_cast<CXXMethodDecl>(decl)) { + for (auto i = m->begin_overridden_methods(); + i != m->end_overridden_methods(); ++i) + { + auto proto2 = (*i)->getType()->getAs<FunctionProtoType>(); + assert(proto2 != nullptr); + if (proto2->getExceptionSpecType() == EST_Dynamic) { + return true; + } + } + } + } bool dtor = isa<CXXDestructorDecl>(decl); auto source = decl->getExceptionSpecSourceRange(); if (rewriter != nullptr && source.isValid()) { @@ -93,6 +107,9 @@ public: } } if (!s.empty() && s != "\\") { + if (s.startswith("//")) { + beg = source.getBegin(); + } break; } beg = prev; @@ -110,7 +127,6 @@ public: : "remove dynamic exception specification"), source.isValid() ? source.getBegin() : decl->getLocation()) << (source.isValid() ? source : decl->getSourceRange()); -#endif return true; } |