summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Toth <jonas.toth@gmail.com>2018-10-04 15:49:25 +0000
committerJonas Toth <jonas.toth@gmail.com>2018-10-04 15:49:25 +0000
commita385d23883e98c361ce35091b5f0511d75cf755c (patch)
treec785782578068453b117a59a145a21d453f45381
parent806794bac16224d46007380f2959444eb4da4341 (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
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
index a5e54c0a182..6d1f7a7827e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
+++ b/clang-tools-extra/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(),