]> granicus.if.org Git - clang/commit
Always build a new TypeSourceInfo for function templates with parameters
authorNico Weber <nicolasweber@gmx.de>
Mon, 1 Feb 2016 22:31:51 +0000 (22:31 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 1 Feb 2016 22:31:51 +0000 (22:31 +0000)
commit118951ce7f8a66acdb8cb0394c1fd8070dcbe6e9
treea47f30fb50a1b979f205ebe191b81a1dead9c044
parent5033bd84e79f48e4c0caa879f77044125d1df228
Always build a new TypeSourceInfo for function templates with parameters

RecursiveASTVisitor::TraverseFunctionHelper() traverses a function's
ParmVarDecls by going to the function's getTypeSourceInfo if it exists, and
`DEF_TRAVERSE_TYPELOC(FunctionProtoType` then goes to the function's
ParmVarDecls.

For a function template that doesn't have parameters that explicitly depend on
the template parameter, we used to be clever and not build a new
TypeSourceInfo. That meant that when an instantiation of such a template is
visited, its TypeSourceInfo would point to the ParmVarDecls of the template,
not of the instantiation, which then confused clients of RecursiveASTVisitor.

So don't be clever for function templates that have parameters, even if none of
the parameters depend on the type.

Fixes PR26257.
http://reviews.llvm.org/D16478

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