summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhivael <dhivael.git@eno.space>2016-11-19 02:32:00 +0100
committerdhivael <dhivael.git@eno.space>2016-11-26 21:22:13 +0100
commite03a66cfd23c1adefbeb65eed2513092d09683b2 (patch)
treeaabddbbb0e885528d1ca8a07b3dfbeae3e094f1a
parent3ba8aabf3dc49525b4c25a1790912aaf24b7484a (diff)
explicitly walk template instantiations
-rw-r--r--static-noexcept.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/static-noexcept.cpp b/static-noexcept.cpp
index dc6f103..978dbd0 100644
--- a/static-noexcept.cpp
+++ b/static-noexcept.cpp
@@ -321,7 +321,6 @@ public:
template<typename Derived>
class NoexceptVisitor : public RecursiveASTVisitor<Derived> {
public:
- bool shouldVisitTemplateInstantiations() const { return true; }
bool shouldVisitImplicitCode() const { return true; }
bool TraverseFunctionDecl(FunctionDecl* fn)
@@ -387,6 +386,9 @@ public:
if (!callee)
return true;
+ if (callee->isTemplateInstantiation())
+ TraverseFunctionDecl(callee);
+
if (implicitNoexceptFunctions.count(callee->getCanonicalDecl()))
return true;
@@ -414,14 +416,23 @@ public:
if (!ctorType)
break;
+ if (ctor->isTemplateInstantiation())
+ TraverseFunctionDecl(ctor);
+
if (ctorType->getNoexceptSpec(sema.Context) == FunctionProtoType::NR_Nothrow)
break;
static_cast<Derived&>(*this).onThrowingExprFound(c);
} while (0);
- if (checkDestructorOnConstruction)
- checkDestructor(c->getConstructor()->getParent(), c);
+ if (checkDestructorOnConstruction) {
+ auto* parent = c->getConstructor()->getParent();
+ auto* dtor = parent->getDestructor();
+ if (dtor && dtor->isTemplateInstantiation())
+ TraverseFunctionDecl(dtor);
+
+ checkDestructor(parent, c);
+ }
return true;
}