From ecef9fa6ef2f1500522763d354ed1dee5201b085 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 15 Mar 2018 15:47:20 +0000 Subject: [OPENMP] Codegen for `omp declare target` construct. Added initial codegen for device side of declarations inside `omp declare target` construct + codegen for implicit `declare target` functions, which are used in the target regions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327636 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseOpenMP.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/Parse/ParseOpenMP.cpp') diff --git a/lib/Parse/ParseOpenMP.cpp b/lib/Parse/ParseOpenMP.cpp index d34fad8fad..77c5d23b14 100644 --- a/lib/Parse/ParseOpenMP.cpp +++ b/lib/Parse/ParseOpenMP.cpp @@ -758,6 +758,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( if (!Actions.ActOnStartOpenMPDeclareTargetDirective(DTLoc)) return DeclGroupPtrTy(); + llvm::SmallVector Decls; DKind = ParseOpenMPDirectiveKind(*this); while (DKind != OMPD_end_declare_target && DKind != OMPD_declare_target && Tok.isNot(tok::eof) && Tok.isNot(tok::r_brace)) { @@ -772,6 +773,10 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( Ptr = ParseCXXClassMemberDeclarationWithPragmas(AS, Attrs, TagType, Tag); } + if (Ptr) { + DeclGroupRef Ref = Ptr.get(); + Decls.append(Ref.begin(), Ref.end()); + } if (Tok.isAnnotation() && Tok.is(tok::annot_pragma_openmp)) { TentativeParsingAction TPA(*this); ConsumeAnnotationToken(); @@ -797,7 +802,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( Diag(DTLoc, diag::note_matching) << "'#pragma omp declare target'"; } Actions.ActOnFinishOpenMPDeclareTargetDirective(); - return DeclGroupPtrTy(); + return DeclGroupPtrTy::make(DeclGroupRef::Create( + Actions.getASTContext(), Decls.begin(), Decls.size())); } case OMPD_unknown: Diag(Tok, diag::err_omp_unknown_directive); -- cgit v1.2.1