]> granicus.if.org Git - clang/commit
Make ParentMap work with explicit specializations of function templates.
authorNico Weber <nicolasweber@gmx.de>
Mon, 8 Feb 2016 22:23:09 +0000 (22:23 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 8 Feb 2016 22:23:09 +0000 (22:23 +0000)
commitbd72f06a7087050c7148b0a199956cf268a2545d
tree2358955fd854bc76ccf3530734c7909a08212f48
parentd62c7a0c1b0f82df99cabee9c80c6aac97518572
Make ParentMap work with explicit specializations of function templates.

For an explicit specialization, we first build a FunctionDecl, and then
we call SubstDecl() on it to build a second FunctionDecl, which has the
first FunctionDecl as canonical decl.

The address of an explicit specialization of function template used to be the
canonical decl of the FunctionDecl.  This is different from all the other
DeduceTemplateArguments() calls in SemaOverload, and since the canonical decl
isn't visited by ParentMap while the redecl is, it also made ParentMap assert
when computing the parent of a address-of-explicit-specialization-fun-template.

To fix, remove the getCanonicalDecl() call.  No behavior difference for clang,
but it fixes an assert in ParentMap (which is e.g. used by libTooling).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260159 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaOverload.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp