[PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

don hinton via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 10:47:54 PDT 2016


hintonda added inline comments.

================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:39
@@ +38,3 @@
+
+  // FIXME: Add paren matching so we can parse more complex throw statements,
+  // e.g., (examples provided by Aaron Ballman):
----------------
aaron.ballman wrote:
> @alexfh, what are your feelings on this FIXME? I am a bit concerned because these examples will cause the replacement range to be incorrect, which will turn working code into ill-formed code. The alternative, as I see it, is to instead properly track the exception specification source range information as part of the FunctionDecl (akin to `FunctionDecl::getReturnTypeSourceRange()`).
Btw, I'm working on a fix I believe will handle all cases -- plan to checkin later today.  However, it won't be that efficient unless I can find a way to match params that contain dynamic exception specifications.  If they are only legal for function pointers -- which I think is the case -- that would make it easy and efficient, i.e., I wouldn't have to match all FunctionDecl's with one or more parameter and test them.

Is it possible to match a parameter that is a function pointer?

================
Comment at: docs/clang-tidy/checks/modernize-use-noexcept.rst:40
@@ +39,3 @@
+``noexcept(false)`` not ``noexcept``, this check will detect, but not
+provide a FixItHint in that case.
+
----------------
aaron.ballman wrote:
> This seems to run contrary to one of the examples below where a fixit is provided for ``throw(A, B)``. If I understood properly, this statement is only true when using a ReplacementString. Perhaps it should instead say, "this check will detect, but not
> provide a FixItHint for this case when a :option:`ReplacementString` is provided."
This is only applicable when the user provided a replacement string other than noexcept.  I'll try to make it clearer, however, there is a FIXME in the code concerning this.  Specifically, should we allow replacement options for both noexcept and noexcept(false).


http://reviews.llvm.org/D18575





More information about the cfe-commits mailing list