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

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 09:17:59 PDT 2023


================
@@ -3176,6 +3178,11 @@ def err_alignas_underaligned : Error<
   "requested alignment is less than minimum alignment of %1 for type %0">;
 def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
   InGroup<IgnoredAttributes>;
+def err_ctor_dtor_attr_on_non_void_func : Error<
+  "%0 attribute can only be applied to a function which accepts no arguments "
+  "and has a 'void' or 'int' return type">;
----------------
nickdesaulniers wrote:

IIRC, there's a similar restriction for `__attribute__((cleanup()))` functions. Is there an existing Diag we can use here from that?

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


More information about the cfe-commits mailing list