[PATCH] D134588: [clang-tidy] Fix bugprone-exception-escape warn on noexcept calls

Gergely Nagy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 24 08:11:21 PDT 2022


ngg created this revision.
ngg added reviewers: clang-tools-extra, njames93.
Herald added subscribers: carlosgalvezp, lebedev.ri, xazax.hun.
Herald added a reviewer: lebedev.ri.
Herald added a project: All.
ngg requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

If there is a function call that calls a non-throwing function,
this check should not report a warning, even if there is a throw
statement within that function.

The dependent_throw() test case was misleading and suggested that this
warning is not triggered when a throw exception is in unreachable code,
but in reality that warning did not trigger because it could not
determine whether the function should be noexcept without specializing
the T template argument. That test case is fixed to show non-specialized
and specialized cases.

Fixes https://github.com/llvm/llvm-project/issues/54668 and
https://github.com/llvm/llvm-project/issues/54956.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134588

Files:
  clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
  clang-tools-extra/clang-tidy/openmp/ExceptionEscapeCheck.cpp
  clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
  clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.h
  clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134588.462674.patch
Type: text/x-patch
Size: 11864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220924/b85633f0/attachment.bin>


More information about the cfe-commits mailing list