summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 6585917925..5338242d25 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -388,8 +388,16 @@ static void instantiateOMPDeclareVariantAttr(
if (Expr *E = Attr.getVariantFuncRef())
VariantFuncRef = Subst(E);
- (void)S.ActOnOpenMPDeclareVariantDirective(
- S.ConvertDeclToDeclGroup(New), VariantFuncRef.get(), Attr.getRange());
+ // Check function/variant ref.
+ Optional<std::pair<FunctionDecl *, Expr *>> DeclVarData =
+ S.checkOpenMPDeclareVariantFunction(
+ S.ConvertDeclToDeclGroup(New), VariantFuncRef.get(), Attr.getRange());
+ if (!DeclVarData)
+ return;
+ // Instantiate the attribute.
+ S.ActOnOpenMPDeclareVariantDirective(DeclVarData.getValue().first,
+ DeclVarData.getValue().second,
+ Attr.getRange());
}
static void instantiateDependentAMDGPUFlatWorkGroupSizeAttr(