Warnings will now only be printed for function definitions, not declarations
Reviewed By: isuckatcs
Differential Revision: https://reviews.llvm.org/
D148462
void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- functionDecl(anyOf(isNoThrow(), cxxDestructorDecl(),
+ functionDecl(isDefinition(),
+ anyOf(isNoThrow(), cxxDestructorDecl(),
cxxConstructorDecl(isMoveConstructor()),
cxxMethodDecl(isMoveAssignmentOperator()),
hasName("main"), hasName("swap"),
<clang-tidy/checks/bugprone/dynamic-static-initializers>` check.
Global options of the same name should be used instead.
+- Improved :doc:`bugprone-exception-escape
+ <clang-tidy/checks/bugprone/exception-escape>` to not emit warnings for
+ forward declarations of functions.
+
- Improved :doc:`bugprone-fold-init-type
<clang-tidy/checks/bugprone/fold-init-type>` to handle iterators that do not
define `value_type` type aliases.
}
int indirectly_recursive(int n) noexcept;
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'indirectly_recursive' which should not throw exceptions
int recursion_helper(int n) {
indirectly_recursive(n);