JonasToth created this revision.
JonasToth added reviewers: alexfh, aaron.ballman, baloghadamsoftware.
Herald added subscribers: cfe-commits, rnkovacs, xazax.hun.

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.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52880

Files:
  clang-tidy/bugprone/ExceptionEscapeCheck.cpp


Index: clang-tidy/bugprone/ExceptionEscapeCheck.cpp
===================================================================
--- clang-tidy/bugprone/ExceptionEscapeCheck.cpp
+++ clang-tidy/bugprone/ExceptionEscapeCheck.cpp
@@ -186,6 +186,9 @@
 }
 
 void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus || !getLangOpts().CXXExceptions)
+    return;
+
   Finder->addMatcher(
       functionDecl(allOf(throws(unless(isIgnored(IgnoredExceptions))),
                          anyOf(isNoThrow(), cxxDestructorDecl(),


Index: clang-tidy/bugprone/ExceptionEscapeCheck.cpp
===================================================================
--- clang-tidy/bugprone/ExceptionEscapeCheck.cpp
+++ clang-tidy/bugprone/ExceptionEscapeCheck.cpp
@@ -186,6 +186,9 @@
 }
 
 void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus || !getLangOpts().CXXExceptions)
+    return;
+
   Finder->addMatcher(
       functionDecl(allOf(throws(unless(isIgnored(IgnoredExceptions))),
                          anyOf(isNoThrow(), cxxDestructorDecl(),
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to