[clang] Warning for incorrect useof 'pure' attribute (PR #78200)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 06:11:36 PST 2024


================
@@ -692,6 +692,16 @@ def warn_maybe_falloff_nonvoid_function : Warning<
 def warn_falloff_nonvoid_function : Warning<
   "non-void function does not return a value">,
   InGroup<ReturnType>;
+def warn_const_attr_with_pure_attr : Warning<
+  "'const' attribute imposes greater restrictions than 'pure', 'pure' attribute ignored">,
+  InGroup<IgnoredAttributes>;
+def warn_pure_attr_on_cxx_constructor : Warning<
+  "constructor cannot be '%select{pure|const}0', attribute ignored">,
+  InGroup<IgnoredAttributes>;
+def warn_pure_function_returns_void : Warning<
+  "'%select{pure|const}0' attribute on function returning 'void'">,
----------------
AaronBallman wrote:

I think this should also say `; attribute ignored` and be under the `IgnoredAttribtues` warning group. The attribute has no semantics for a function which returns `void`.

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


More information about the cfe-commits mailing list