This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Check functions called from catch blocks
ClosedPublic

Authored by denizevrenci on Jun 6 2023, 6:28 PM.

Details

Summary

These functions can rethrow a current exception that is caught by the
catch block. We can pass the currently caught excections to the function
declaration analyzer just like the statement analyzer to handle this
case.

Diff Detail

Event Timeline

denizevrenci created this revision.Jun 6 2023, 6:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 6:28 PM
denizevrenci requested review of this revision.Jun 6 2023, 6:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 6:28 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ChuanqiXu added inline comments.Jun 6 2023, 7:00 PM
clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
132–136

I don't know clang-tidy a lot. But is these two branches different in clang-tidy really?

denizevrenci added inline comments.Jun 6 2023, 7:09 PM
clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
132–136

Yes, rethrows are handled differently than throw expressions with arguments. You can find the relevant implementation in ExceptionAnalyzer.cpp:[462:475].

ChuanqiXu accepted this revision.Jun 6 2023, 7:33 PM

LGTM. And please wait for several days for other reviewers.

clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
132–136

OK, sounds good to me.

This revision is now accepted and ready to land.Jun 6 2023, 7:33 PM

Rebase on main

denizevrenci marked 2 inline comments as done.Jun 6 2023, 7:42 PM

Sort out tests

Sort tests out a bit more

Rebase on main