[PATCH] D135495: [clang-tidy] handle pointers in `ExceptionAnalyzer`
Domján Dániel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 15:36:26 PDT 2022
isuckatcs created this revision.
isuckatcs added reviewers: njames93, baloghadamsoftware, aaron.ballman, LegalizeAdulthood.
Herald added subscribers: carlosgalvezp, manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, a.sidorin, rnkovacs, xazax.hun.
Herald added a project: All.
isuckatcs requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
`ExceptionAnalyzer` only compared exact types in case of pointer,
which is incorrect. An `int *` can be caught by a `const int *` handler,
but `ExceptionAnalyzer` falsely reported it an escaping exception.
For example:
void foo() noexcept {
try {
int a = 1;
throw &a;
} catch (const int *) {
}
}
In function `foo()` the `&a` is caught by the handler, but clang-tidy
reports the following warning:
warning: an exception may be thrown in function 'foo' which should not throw exceptions [bugprone-exception-escape]
https://reviews.llvm.org/D135495
Files:
clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135495.466200.patch
Type: text/x-patch
Size: 4190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221007/14b47bd9/attachment.bin>
More information about the cfe-commits
mailing list