[PATCH] D148458: [clang-tidy][NFC] Split bugprone-exception-escape tests

Domján Dániel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 30 14:42:15 PDT 2023


isuckatcs added a comment.

Do we really want to split these two functions apart to different test files? Is this really NFC?

The way `ExceptionEscapeCheck` works is that it creates an `ExceptionAnalyzer` upon instantiation.

//By the way upon looking at the constructor of the check I see that std::bad_alloc is always ignored.
Maybe we want to turn this into an option, so that users can enable it if they want.//

`ExceptionAnalyzer` caches functions based on their `FunctionDecl *` in
`std::map<const FunctionDecl *, ExceptionInfo> FunctionCache;`.

The `FunctionDecl` lives in the AST of the translation unit, so the same function declaration in two
different translation units will have different `FunctionDecl *`s. //Maybe `ODRHash` would be more
suitable to be used as key in the map.//

By moving throwing functions into a different TU than non-throwing functions, I think the correctness
of the caching inside `ExceptionAnalyzer` no longer will be tested properly. Maybe this is something
we want to preserve.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148458/new/

https://reviews.llvm.org/D148458



More information about the cfe-commits mailing list