Haojian Wu 434ac4612f
Improve the -Wundefined-func-template diagnostic note for invisible template functions (#129031)
See discussion in https://github.com/llvm/llvm-project/issues/125071.

Makes the note clearer for the unreachable case:

Before:
```
./hoge.h:5:12: warning: instantiation of function 'x<int>' required here, but no definition is available [-Wundefined-func-template]
    5 | void f() { x<int>(); }
      |            ^
./shared_ptr2.h:4:6: note: forward declaration of template entity is here
    4 | void x() { T t; (void)t; }
      |      ^
./hoge.h:5:12: note: add an explicit instantiation declaration to suppress this warning if 'x<int>' is explicitly instantiated in another translation unit
    5 | void f() { x<int>(); }
      |    
```

After:

```
./hoge.h:5:12: warning: instantiation of function 'x<int>' required here, but no definition is available [-Wundefined-func-template]
    5 | void f() { x<int>(); }
      |            ^
./shared_ptr2.h:4:6: note: declaration of template entity is unreachable here
    4 | void x() { T t; (void)t; }
      |      ^
1 warning generated.
```
2025-03-19 10:51:45 +01:00
..

See llvm/docs/README.txt