diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-07 12:45:37 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-07 12:45:37 +0000 |
commit | 2af33e3d3ff1cd0535602cf50b06539949a2b16b (patch) | |
tree | bcb4ff52ff2115bc25342cf17c17e4b4c2d82f56 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | a1feff7024b552b579f302fea0030aaaa14624b3 (diff) | |
download | bcm5719-llvm-2af33e3d3ff1cd0535602cf50b06539949a2b16b.tar.gz bcm5719-llvm-2af33e3d3ff1cd0535602cf50b06539949a2b16b.zip |
[OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'
construct.
OpenMP 4.0 defines '#pragma omp declare simd' construct that may have
associated 'simdlen' clause with constant positive expression as an
argument:
simdlen(<const_expr>)
Patch adds parsin and semantic analysis for simdlen clause.
llvm-svn: 265668
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 2d87b041821..c60a17abc6f 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -235,6 +235,22 @@ instantiateDependentModeAttr(Sema &S, Attr.getSpellingListIndex(), /*InInstantiation=*/true); } +/// Instantiation of 'declare simd' attribute and its arguments. +static void instantiateOMPDeclareSimdDeclAttr( + Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, + const OMPDeclareSimdDeclAttr &Attr, Decl *New) { + ExprResult Simdlen; + if (auto *E = Attr.getSimdlen()) { + Simdlen = S.SubstExpr(E, TemplateArgs); + if (Simdlen.isInvalid()) + return; + } + + (void)S.ActOnOpenMPDeclareSimdDirective(S.ConvertDeclToDeclGroup(New), + Attr.getBranchState(), Simdlen.get(), + Attr.getRange()); +} + void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Tmpl, Decl *New, LateInstantiatedAttrVec *LateAttrs, @@ -278,6 +294,11 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, continue; } + if (const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) { + instantiateOMPDeclareSimdDeclAttr(*this, TemplateArgs, *OMPAttr, New); + continue; + } + // Existing DLL attribute on the instantiation takes precedence. if (TmplAttr->getKind() == attr::DLLExport || TmplAttr->getKind() == attr::DLLImport) { |