diff options
author | Jonas Toth <jonas.toth@gmail.com> | 2018-10-04 15:49:25 +0000 |
---|---|---|
committer | Jonas Toth <jonas.toth@gmail.com> | 2018-10-04 15:49:25 +0000 |
commit | 93953d46c25637eafaf8e1a8450f6274caa101eb (patch) | |
tree | e1b1711057db6f9352dfe4e88a293ef09ce7404d /clang-tidy/bugprone | |
parent | 29c9ca65c6920b4ea2cc4ed50fd1587865ed9fb1 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@343789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/bugprone')
-rw-r--r-- | clang-tidy/bugprone/ExceptionEscapeCheck.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tidy/bugprone/ExceptionEscapeCheck.cpp b/clang-tidy/bugprone/ExceptionEscapeCheck.cpp index a5e54c0a..6d1f7a78 100644 --- a/clang-tidy/bugprone/ExceptionEscapeCheck.cpp +++ b/clang-tidy/bugprone/ExceptionEscapeCheck.cpp @@ -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(), |