[clang-tools-extra] r343789 - [clang-tidy] fix PR39167, bugprone-exception-escape hangs-up
Jonas Toth via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 4 08:49:25 PDT 2018
Author: jonastoth
Date: Thu Oct 4 08:49:25 2018
New Revision: 343789
URL: http://llvm.org/viewvc/llvm-project?rev=343789&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ExceptionEscapeCheck.cpp?rev=343789&r1=343788&r2=343789&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/ExceptionEscapeCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/ExceptionEscapeCheck.cpp Thu Oct 4 08:49:25 2018
@@ -186,6 +186,9 @@ void ExceptionEscapeCheck::storeOptions(
}
void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
+ if (!getLangOpts().CPlusPlus || !getLangOpts().CXXExceptions)
+ return;
+
Finder->addMatcher(
functionDecl(allOf(throws(unless(isIgnored(IgnoredExceptions))),
anyOf(isNoThrow(), cxxDestructorDecl(),
More information about the cfe-commits
mailing list