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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 03:56:22 PDT 2018


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(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52880.168262.patch
Type: text/x-patch
Size: 552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181004/00293bac/attachment.bin>


More information about the cfe-commits mailing list