summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-09-04 22:14:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-09-04 22:14:50 +0000
commit71c37a8fdaa8c5abbb3c614576659e5a948781e6 (patch)
tree57e4ea7fcb684ba7442eb89ea559b11bb8c68950
parent44ca0c55f0df0ba254b79f187e51b4b0d0b28ed7 (diff)
downloadbcm5719-llvm-71c37a8fdaa8c5abbb3c614576659e5a948781e6.tar.gz
bcm5719-llvm-71c37a8fdaa8c5abbb3c614576659e5a948781e6.zip
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in lambda-expressions. llvm-svn: 370991
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp3
-rw-r--r--clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp7
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 6e4f9b99478..5ef16b4a375 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 3bec64156a9..b88b0d56fd9 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<typename> void f() {
+ // CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_(
+ auto x = [](auto){};
+ x(0);
+}
+void use_f() { f<int>(); }
OpenPOWER on IntegriCloud