[clang-tidy] fix PR39167, bugprone-exception-escape hangs-up

Summary:
The check bugprone-exception-escape should not register
if -fno-exceptions is set for the compile options. Bailing out on non-cplusplus
and non-exceptions language options resolves the issue.

Reviewers: alexfh, aaron.ballman, baloghadamsoftware

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, rnkovacs, cfe-commits

Differential Revision: https://reviews.llvm.org/D52880

llvm-svn: 343789
This commit is contained in:
Jonas Toth 2018-10-04 15:49:25 +00:00
parent c97671e5da
commit 9b1cc0121c
1 changed files with 3 additions and 0 deletions

View File

@ -186,6 +186,9 @@ void ExceptionEscapeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus || !getLangOpts().CXXExceptions)
return;
Finder->addMatcher(
functionDecl(allOf(throws(unless(isIgnored(IgnoredExceptions))),
anyOf(isNoThrow(), cxxDestructorDecl(),