r370991 - For PR43213, track whether template parameters are implicit through
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 4 15:14:50 PDT 2019
Author: rsmith
Date: Wed Sep 4 15:14:50 2019
New Revision: 370991
URL: http://llvm.org/viewvc/llvm-project?rev=370991&view=rev
Log:
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in
lambda-expressions.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=370991&r1=370990&r2=370991&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Sep 4 15:14:50 2019
@@ -2337,6 +2337,7 @@ Decl *TemplateDeclInstantiator::VisitTem
D->getDepth() - TemplateArgs.getNumSubstitutedLevels(), D->getIndex(),
D->getIdentifier(), D->wasDeclaredWithTypename(), D->isParameterPack());
Inst->setAccess(AS_public);
+ Inst->setImplicit(D->isImplicit());
if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
TypeSourceInfo *InstantiatedDefaultArg =
@@ -2483,6 +2484,7 @@ Decl *TemplateDeclInstantiator::VisitNon
D->getPosition(), D->getIdentifier(), T, D->isParameterPack(), DI);
Param->setAccess(AS_public);
+ Param->setImplicit(D->isImplicit());
if (Invalid)
Param->setInvalidDecl();
@@ -2626,6 +2628,7 @@ TemplateDeclInstantiator::VisitTemplateT
D->getDefaultArgument().getTemplateNameLoc()));
}
Param->setAccess(AS_public);
+ Param->setImplicit(D->isImplicit());
// Introduce this template parameter's instantiation into the instantiation
// scope.
Modified: cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp?rev=370991&r1=370990&r2=370991&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp Wed Sep 4 15:14:50 2019
@@ -32,3 +32,10 @@ inline void inline_func() {
void call_inline_func() {
inline_func();
}
+
+template<typename> void f() {
+ // CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_(
+ auto x = [](auto){};
+ x(0);
+}
+void use_f() { f<int>(); }
More information about the cfe-commits
mailing list