================ @@ -1398,11 +1398,16 @@ void Sema::ActOnEndOfTranslationUnit() { if (FD->getDescribedFunctionTemplate()) Diag(DiagD->getLocation(), diag::warn_unused_template) << /*function=*/0 << DiagD << DiagRange; - else - Diag(DiagD->getLocation(), isa<CXXMethodDecl>(DiagD) - ? diag::warn_unused_member_function - : diag::warn_unused_function) - << DiagD << DiagRange; + else { + if (isa<CXXMethodDecl>(DiagD)) + Diag(DiagD->getLocation(), diag::warn_unused_member_function) + << (!isa<CXXConstructorDecl>(DiagD) ? /*member function=*/0 + : /*constructor=*/1) + << DiagD << DiagRange; + else + Diag(DiagD->getLocation(), diag::warn_unused_function) + << DiagD << DiagRange; + } ---------------- guillem-bartina-sonarsource wrote:
Note that `warn_unused_function` and `warn_unused_member_function` are two different diagnostics, with different messages. The former has only one argument, whereas the latter now has two (one of them selects between `member function` and `constructor`). Unless I'm missing some hidden logic regarding diagnostic constructors and the '<<' operator, we can't merge the two because the two diagnostics have different number of arguments. 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