[clang] WIP: Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 28 06:19:41 PST 2025


================
@@ -5082,11 +5085,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
       if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
           !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) {
         Diag(PointOfInstantiation, diag::warn_func_template_missing)
-          << Function;
-        Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
-        if (getLangOpts().CPlusPlus11)
-          Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
-              << Function;
+            << Function;
+        if (Unreachable) {
----------------
hokein wrote:

Yes, I think it is possible to do it (by reusing some of the functionalities from `diagnoseMissingImport`), but it will require some refactoring. I will leave it as a followup patch. Added a FIXME.

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


More information about the cfe-commits mailing list