================
@@ -402,7 +402,7 @@ def warn_unused_function : Warning<"unused function %0">,
   InGroup<UnusedFunction>, DefaultIgnore;
 def warn_unused_template : Warning<"unused %select{function|variable}0 
template %1">,
   InGroup<UnusedTemplate>, DefaultIgnore;
-def warn_unused_member_function : Warning<"unused member function %0">,
+def warn_unused_member_function : Warning<"unused %select{constructor|member 
function %1}0">,
----------------
guillem-bartrina-sonarsource wrote:

Hello @AaronBallman, and thanks for this recommendation.

I clearly see the advantages it brings, namely refining the message also for 
other special members and avoiding having to do the type test for the different 
nodes at the diagnosis creation site.

However, note that only *default* constructors are considered “special members” 
(see `CXXSpecialMemberKind`). Therefore, using this trick would not avoid 
having to manually spell `constructor` in the template because it would still 
be necessary to treat them specially. The trick would just refine the message 
for other special members with little additional effort.

The template would then be something like
```text
def warn_unused_member_function : Warning<"unused %select{"
                                          "member function %1|"
                                          "constructor|"
                                          
"%sub{select_special_member_kind}1}0">,
  InGroup<UnusedMemberFunction>, DefaultIgnore;
```

WDYT?

https://github.com/llvm/llvm-project/pull/84515
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to