Replace the custom AST matcher for nothrow functions with the canonical AST matcher from r254516.

llvm-svn: 254517
This commit is contained in:
Aaron Ballman 2015-12-02 15:24:47 +00:00
parent a60bcdab92
commit c5a6da0ed1
3 changed files with 2 additions and 18 deletions

View File

@ -26,7 +26,7 @@ void StaticObjectExceptionCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
varDecl(anyOf(hasThreadStorageDuration(), hasStaticStorageDuration()),
hasInitializer(cxxConstructExpr(hasDeclaration(
cxxConstructorDecl(unless(matchers::isNoThrow()))
cxxConstructorDecl(unless(isNoThrow()))
.bind("ctor")))))
.bind("var"),
this);

View File

@ -23,7 +23,7 @@ void ThrownExceptionTypeCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
cxxThrowExpr(
has(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
isCopyConstructor(), unless(matchers::isNoThrow()))))
isCopyConstructor(), unless(isNoThrow()))))
.bind("expr"))),
this);
}

View File

@ -23,22 +23,6 @@ AST_MATCHER(QualType, isExpensiveToCopy) {
return IsExpensive && *IsExpensive;
}
AST_MATCHER(FunctionDecl, isNoThrow) {
const auto *FnTy = Node.getType()->getAs<FunctionProtoType>();
// If the function does not have a prototype, then it is assumed to be a
// throwing function (as it would if the function did not have any exception
// specification).
if (!FnTy)
return false;
// Assume the best for any unresolved exception specification.
if (isUnresolvedExceptionSpec(FnTy->getExceptionSpecType()))
return true;
return FnTy->isNothrow(Node.getASTContext());
}
} // namespace matchers
} // namespace tidy
} // namespace clang