[PATCH] D135495: [clang-tidy] handle pointers in `ExceptionAnalyzer`

Domján Dániel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 25 08:03:54 PST 2023


isuckatcs added a comment.

This patch got a little bit out of control at the last revision, so I decided to remove every change from clang and add everything to the `ExceptionAnalyzer` only.
The reason for that is with exceptions we have less conversions to check than we have inside the compiler, which can lead to confusion.

For example:

  class A {};
  class B : public A {};
  
  int A::* pa;
  int B::* pb = pa; <-- valid outside of exception handler, invalid in exception handler

We can have the conversion `int B::* pb = pa;` because of `7.3.12 Pointer-to-member conversions`, which is by standard not performed when an exception needs to be caught.
See godbolt <https://godbolt.org/z/fj4Y4xfoM>. (MSVC does catch `A::*` with a `B::*` handler for some reason, maybe I miss some flag)

For the above reason, sadly we can't test the changes the way you suggested @xazax.hun, like checking if the assigment compiles or not.


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

https://reviews.llvm.org/D135495



More information about the cfe-commits mailing list