diff options
author | Erich Keane <erich.keane@intel.com> | 2018-08-13 18:33:20 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-08-13 18:33:20 +0000 |
commit | 0fb16483ac67f07af51b982e6f158078b5744154 (patch) | |
tree | 48ada68cd1ad0a16a20dbd4e504d609b9283ad47 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | a37bba47279164c7cd18a50279cdeb3185718095 (diff) | |
download | bcm5719-llvm-0fb16483ac67f07af51b982e6f158078b5744154.tar.gz bcm5719-llvm-0fb16483ac67f07af51b982e6f158078b5744154.zip |
Enforce instantiation of template multiversion functions
Multiversioned member functions inside of a template type were
not properly being emitted. The solution to this is to simply
ensure that their bodies are correctly evaluated/assigned during
template instantiation.
llvm-svn: 339597
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 4c1d56b8311..80980106c4d 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -5175,10 +5175,20 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) { bool DefinitionRequired = Function->getTemplateSpecializationKind() == TSK_ExplicitInstantiationDefinition; - InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true, - DefinitionRequired, true); - if (Function->isDefined()) - Function->setInstantiationIsPending(false); + if (Function->isMultiVersion()) { + getASTContext().forEachMultiversionedFunctionVersion( + Function, [this, Inst, DefinitionRequired](FunctionDecl *CurFD) { + InstantiateFunctionDefinition(/*FIXME:*/ Inst.second, CurFD, true, + DefinitionRequired, true); + if (CurFD->isDefined()) + CurFD->setInstantiationIsPending(false); + }); + } else { + InstantiateFunctionDefinition(/*FIXME:*/ Inst.second, Function, true, + DefinitionRequired, true); + if (Function->isDefined()) + Function->setInstantiationIsPending(false); + } continue; } |