[PATCH] D113507: [clang-tidy] Include constructor initializers in `bugprone-exception-escape` check

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 8 06:07:15 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-exception-escape.cpp:291-293
+struct super_throws {
+  super_throws() noexcept(false) { throw 42; }
+};
----------------
I think this needs additional test coverage.

Dynamic exception specifications:
```
struct super_throws_again {
  super_throws_again() throw(int);
};

struct sub_throws_again : super_throws_again {
  sub_throws_again() noexcept : super_throws_again() {}
};
```
Non-base class explicit inits:
```
struct init_member_throws {
  super_throws s;

  init_member_throws() noexcept : s() {}
};
```
Non-base class implicit inits:
```
struct init_member_throws {
  super_throws s;

  init_member_throws() noexcept {}
};
```
In-class initializers (IIRC those are modeled as a ctor init):
```
struct init {
  explicit init(int, int) noexcept(false);
};

struct in_class_init_throws {
  init i{1, 2};
};
```
I *think* all of these will wind up being covered by the code changes, but we should test them to be sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113507



More information about the cfe-commits mailing list