From: Richard Smith Date: Wed, 4 Sep 2019 22:14:50 +0000 (+0000) Subject: For PR43213, track whether template parameters are implicit through X-Git-Tag: llvmorg-11-init~10010 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71c37a8fdaa8c5abbb3c614576659e5a948781e6;p=platform%2Fupstream%2Fllvm.git For PR43213, track whether template parameters are implicit through template instantiation so we know whether to mangle them in lambda-expressions. llvm-svn: 370991 --- diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 6e4f9b9..5ef16b4 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2337,6 +2337,7 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl( 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::VisitNonTypeTemplateParmDecl( 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::VisitTemplateTemplateParmDecl( D->getDefaultArgument().getTemplateNameLoc())); } Param->setAccess(AS_public); + Param->setImplicit(D->isImplicit()); // Introduce this template parameter's instantiation into the instantiation // scope. diff --git a/clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp b/clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp index 3bec641..b88b0d5 100644 --- a/clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp +++ b/clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp @@ -32,3 +32,10 @@ inline void inline_func() { void call_inline_func() { inline_func(); } + +template void f() { + // CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_( + auto x = [](auto){}; + x(0); +} +void use_f() { f(); }