[PATCH] D148461: [clang-tidy] Support C++17/20 in bugprone-exception-escape

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 16 14:17:20 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp:160-162
+    // FIXME: Two function pointers can differ in 'noexcept', but they still
+    // should be considered to be same, now this triggers false-positive because
+    // Type* != Type*.
----------------
isuckatcs wrote:
> Are you sure `noexcept` is stored in the type? The test case you modified `throw_noexcept_catch_regular()` tests this scenario and in that case the types seem to be the same even though one of the is noexcept an the other is not.
> 
> If the FIXME is valid the proper way would be to implement it in this patch.
Yes I'm sure.
C++11 - no warning
C++14 - no warning
C++17 - warning
Looks like since C++17 noexcept is part of type.
Initially I wanted only to enable tests under C++17/20.
That's why "FIXME". I will look into this.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp:414
       throw &foo;
-    } catch(int (*)()) {
+    } catch(int (*)() noexcept) {
     }
----------------
isuckatcs wrote:
> The name of the function suggests that we throw a noexcept function pointer and catch a non-noexcept one. Please don't change it.
Ack.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148461



More information about the cfe-commits mailing list