forked from OSchip/llvm-project
Replace the custom AST matcher for nothrow functions with the canonical AST matcher from r254516.
llvm-svn: 254517
This commit is contained in:
parent
a60bcdab92
commit
c5a6da0ed1
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue