diff options
author | Krystian Stasiowski <sdkrystian@gmail.com> | 2024-07-08 14:52:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 14:52:40 -0400 |
commit | d52853760183a25758659863b1b940e9502eaa88 (patch) | |
tree | 19afd8f96c34bd2e23ae25e39fd81e0df62e0a20 /clang/test | |
parent | 359c64f314ad568e78ee9a3723260286e3425c2d (diff) | |
download | llvm-d52853760183a25758659863b1b940e9502eaa88.zip llvm-d52853760183a25758659863b1b940e9502eaa88.tar.gz llvm-d52853760183a25758659863b1b940e9502eaa88.tar.bz2 |
[Clang][Index] Add support for dependent class scope explicit specializations of function templates to USRGenerator (#98027)
Given the following:
```
template<typename T>
struct A
{
void f(int); // #1
template<typename U>
void f(U); // #2
template<>
void f<int>(int); // #3
};
```
Clang will generate the same USR for `#1` and `#2`. This patch fixes the
issue by including the template arguments of dependent class scope
explicit specializations in their USRs.
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Index/USR/func-template.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Index/USR/func-template.cpp b/clang/test/Index/USR/func-template.cpp new file mode 100644 index 0000000..c9c82f5 --- /dev/null +++ b/clang/test/Index/USR/func-template.cpp @@ -0,0 +1,15 @@ +// RUN: c-index-test core -print-source-symbols -- %s | FileCheck %s + +template<typename T> +struct A { + void f(int); + // CHECK: {{[0-9]+}}:8 | instance-method/C++ | f | c:@ST>1#T@A@F@f#I# | + + template<typename U> + void f(U); + // CHECK: {{[0-9]+}}:8 | instance-method/C++ | f | c:@ST>1#T@A@FT@>1#Tf#t1.0#v# | + + template<> + void f<int>(int); + // CHECK: {{[0-9]+}}:8 | instance-method/C++ | f | c:@ST>1#T@A@F@f<#I>#I# | +}; |