[index] USR generation: use getTemplateArgs() instead of getTemplateInstantiationArgs()
Otherwise we may end up creating a different USR for the definition of a function, vs its declaration. llvm-svn: 295191
This commit is contained in:
parent
5fb8af40df
commit
7d90ed0ac9
|
@ -310,7 +310,7 @@ void USRGenerator::VisitVarDecl(const VarDecl *D) {
|
|||
// For a template specialization, mangle the template arguments.
|
||||
if (const VarTemplateSpecializationDecl *Spec
|
||||
= dyn_cast<VarTemplateSpecializationDecl>(D)) {
|
||||
const TemplateArgumentList &Args = Spec->getTemplateInstantiationArgs();
|
||||
const TemplateArgumentList &Args = Spec->getTemplateArgs();
|
||||
Out << '>';
|
||||
for (unsigned I = 0, N = Args.size(); I != N; ++I) {
|
||||
Out << '#';
|
||||
|
@ -521,7 +521,7 @@ void USRGenerator::VisitTagDecl(const TagDecl *D) {
|
|||
// For a class template specialization, mangle the template arguments.
|
||||
if (const ClassTemplateSpecializationDecl *Spec
|
||||
= dyn_cast<ClassTemplateSpecializationDecl>(D)) {
|
||||
const TemplateArgumentList &Args = Spec->getTemplateInstantiationArgs();
|
||||
const TemplateArgumentList &Args = Spec->getTemplateArgs();
|
||||
Out << '>';
|
||||
for (unsigned I = 0, N = Args.size(); I != N; ++I) {
|
||||
Out << '#';
|
||||
|
|
|
@ -23,6 +23,16 @@ public:
|
|||
TemplCls<int> gtv(0);
|
||||
// CHECK: [[@LINE-1]]:1 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | <no-cgname> | Ref,RelCont | rel: 1
|
||||
|
||||
template<class T>
|
||||
class Wrapper {};
|
||||
template<class T, class P>
|
||||
class Wrapper<T(P)> {};
|
||||
|
||||
// CHECK: [[@LINE+1]]:6 | function/C | test1 | [[TEST1_USR:.*]] | [[TEST1_CG:.*]] | Decl | rel: 0
|
||||
void test1(Wrapper<void(int)> f);
|
||||
// CHECK: [[@LINE+1]]:6 | function/C | test1 | [[TEST1_USR]] | [[TEST1_CG]] | Def | rel: 0
|
||||
void test1(Wrapper<void(int)> f) {}
|
||||
|
||||
template <typename T>
|
||||
class BT {
|
||||
struct KLR {
|
||||
|
|
Loading…
Reference in New Issue