[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67360)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 17:17:25 PDT 2023


================
@@ -171,6 +171,11 @@ Attribute Changes in Clang
   automatic diagnostic to use parameters of types that the format style
   supports but that are never the result of default argument promotion, such as
   ``float``. (`#59824: <https://github.com/llvm/llvm-project/issues/59824>`_)
+- The ``constructor`` and ``destructor`` attributes now diagnose when:
+  - the priority is not between 101 and 65535, inclusive,
+  - the function it is applied to accepts arguments or has a non-void return
----------------
erichkeane wrote:

I don't think the 'non-void' return type should be diagnosed unless it is 'nodiscard'.  Marking something like 'closeAllHandlesAndReturnAStatusIIntendToIgnore` as a destructor isn't harmful IMO.

https://github.com/llvm/llvm-project/pull/67360


More information about the cfe-commits mailing list